Skip to content

Commit

Permalink
Fix: Concurrency on private key symlink in tests
Browse files Browse the repository at this point in the history
Problem: the ALEPH_VRF_ETHEREUM_PRIVATE_KEY environment variable is not
parsed in the integration tests, resulting in the concurrency issue
thought to be fixed in #18.

Solution: set the value in the settings object directly.
  • Loading branch information
odesenfans committed Sep 28, 2023
1 parent 7f6bd46 commit a47b40d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ def _executor_servers(
) -> ContextManager[Tuple[str]]:
ports = list(range(start_port, start_port + nb_executors))

# Generate a private key for each executor, using `get_fallback_key()` several times
# on the same host can cause concurrency problems. All the executors will have the same
# private key because of this, but this should not be an issue for integration tests.
settings.ETHEREUM_PRIVATE_KEY = HexBytes(generate_key()).hex()

with ExitStack() as cm:
_processes = [
cm.enter_context(
Expand All @@ -118,11 +123,6 @@ def executor_server(mock_ccn: str) -> str:
def executor_servers(mock_ccn: str, request) -> Tuple[str]:
assert mock_ccn, "The mock CCN server must be running"

# Generate a private key for each executor, using `get_fallback_key()` several times
# on the same host can cause concurrency problems. All the executors will have the same
# private key because of this, but this should not be an issue for integration tests.
os.environ["ALEPH_VRF_ETHEREUM_PRIVATE_KEY"] = HexBytes(generate_key()).hex()

nb_executors = request.param
with _executor_servers(nb_executors=nb_executors) as executor_urls:
yield executor_urls
Expand Down

0 comments on commit a47b40d

Please sign in to comment.