Skip to content

Commit

Permalink
Reuse the same account across multiple runs
Browse files Browse the repository at this point in the history
  • Loading branch information
aborg-dev committed Jun 12, 2023
1 parent c898790 commit 0598776
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pytest/tests/loadtest/locust/common/congestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ def on_locust_init(environment, **kwargs):
# `master_funding_account` is the same on all runners, allowing to share a
# single instance of congestion contract.
funding_account = environment.master_funding_account
environment.congestion_account_id = (
f"congestion.{funding_account.key.account_id}")
environment.congestion_account_id = f"congestion.{funding_account.key.account_id}"

# Only create congestion contract on master.
if isinstance(environment.runner, runners.WorkerRunner):
Expand All @@ -91,7 +90,10 @@ def on_locust_init(environment, **kwargs):
funding_account.refresh_nonce(node)

account = base.Account(
key.Key.from_random(environment.congestion_account_id))
key.Key.from_seed_testonly(
environment.congestion_account_id, environment.congestion_account_id
)
)
base.send_transaction(
node,
base.CreateSubAccount(funding_account, account.key, balance=50000.0),
Expand Down

0 comments on commit 0598776

Please sign in to comment.