Skip to content

Commit

Permalink
Merge pull request #2661 from IntersectMBO/multiple_faucets
Browse files Browse the repository at this point in the history
Multiple faucets
  • Loading branch information
mkoura authored Oct 2, 2024
2 parents 103a0c1 + 17f7c69 commit 9708c55
Show file tree
Hide file tree
Showing 73 changed files with 190 additions and 143 deletions.
11 changes: 7 additions & 4 deletions cardano_node_tests/cluster_management/cluster_getter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import pytest
from _pytest.config import Config
from cardano_clusterlib import clusterlib

from cardano_node_tests.cluster_management import common
from cardano_node_tests.cluster_management import resources
Expand Down Expand Up @@ -130,7 +129,7 @@ def instance_dir(self) -> pl.Path:

def _create_startup_files_dir(self, instance_num: int) -> pl.Path:
_instance_dir = self.pytest_tmp_dir / f"{common.CLUSTER_DIR_TEMPLATE}{instance_num}"
rand_str = clusterlib.get_rand_str(8)
rand_str = helpers.get_rand_str(8)
startup_files_dir = _instance_dir / "startup_files" / rand_str
startup_files_dir.mkdir(exist_ok=True, parents=True)
return startup_files_dir
Expand Down Expand Up @@ -256,8 +255,12 @@ def _respin(self, start_cmd: str = "", stop_cmd: str = "") -> bool: # noqa: C90
fp_out.write(cluster_instance_id)
self.log(f"c{self.cluster_instance_num}: started cluster instance '{cluster_instance_id}'")

# Create dir for faucet addresses data
addr_data_dir = state_dir / common.ADDRS_DATA_DIRNAME
# Create dir for faucet addresses data among tests artifacts, so it can be accessed
# during testnet cleanup.
addr_data_dir = (
temptools.get_pytest_worker_tmp() / f"{common.ADDRS_DATA_DIRNAME}_"
f"ci{self.cluster_instance_num}_{cluster_instance_id}"
)
addr_data_dir.mkdir(parents=True, exist_ok=True)

# Setup faucet addresses
Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def detect_fork(
tx_raw_output = clusterlib_utils.fund_from_faucet(
payment_rec,
cluster_obj=cluster_obj,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=2_000_000,
)
assert tx_raw_output
Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/delegation.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def delegate_stake_addr(
clusterlib_utils.fund_from_faucet(
pool_user.payment,
cluster_obj=cluster_obj,
faucet_data=addrs_data["user1"],
all_faucets=addrs_data,
amount=amount,
)

Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_addr_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def pool_users(
clusterlib_utils.fund_from_faucet(
created_users[0],
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
)

return created_users
Expand Down
4 changes: 2 additions & 2 deletions cardano_node_tests/tests/test_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def payment_addrs(
clusterlib_utils.fund_from_faucet(
*addrs,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
)
return addrs

Expand Down Expand Up @@ -404,7 +404,7 @@ def payment_addrs(
clusterlib_utils.fund_from_faucet(
*addrs,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
)
return addrs

Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_chain_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_payment_addr(
clusterlib_utils.fund_from_faucet(
addr,
cluster_obj=cluster_obj,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=amount,
)

Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ def test_pretty_utxo(
clusterlib_utils.fund_from_faucet(
payment_addrs[0],
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=amount1 + amount2 + 10_000_000,
)

Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_dbsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def test_reconnect_dbsync(
clusterlib_utils.fund_from_faucet(
payment_addrs[0],
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=10_000_000,
)

Expand Down
8 changes: 4 additions & 4 deletions cardano_node_tests/tests/test_delegation.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def pool_users(
clusterlib_utils.fund_from_faucet(
created_users[0],
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
)

return created_users
Expand Down Expand Up @@ -127,7 +127,7 @@ def pool_users_cluster_and_pool(
clusterlib_utils.fund_from_faucet(
created_users[0],
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
)

return created_users
Expand Down Expand Up @@ -302,7 +302,7 @@ def _get_pool_users(
clusterlib_utils.fund_from_faucet(
*pool_users,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
)

# Step: Delegate the stake addresses to 2 different pools
Expand Down Expand Up @@ -431,7 +431,7 @@ def test_deregister_delegated(
clusterlib_utils.fund_from_faucet(
*payment_addr_recs,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
)

pool_user = clusterlib.PoolUser(payment=payment_addr_recs[1], stake=stake_addr_rec)
Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_env_network_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def payment_addrs(
clusterlib_utils.fund_from_faucet(
addrs[0],
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=100_000_000,
)
return addrs
Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_governance.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def payment_addr(
clusterlib_utils.fund_from_faucet(
addr,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=amount,
)

Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_mir_certs.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def pool_users(
clusterlib_utils.fund_from_faucet(
*created_users,
cluster_obj=cluster_pots,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
)

return created_users
Expand Down
12 changes: 6 additions & 6 deletions cardano_node_tests/tests/test_native_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def issuers_addrs(
clusterlib_utils.fund_from_faucet(
addrs[0],
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=9_000_000,
)

Expand Down Expand Up @@ -773,7 +773,7 @@ def _mint_tokens() -> clusterlib.TxRawOutput:
clusterlib_utils.fund_from_faucet(
token_mint_addr,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=300_000_000,
)

Expand All @@ -799,7 +799,7 @@ def _mint_tokens() -> clusterlib.TxRawOutput:
clusterlib_utils.fund_from_faucet(
token_mint_addr,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=40_000_000,
)

Expand Down Expand Up @@ -918,7 +918,7 @@ def _mint_tokens() -> clusterlib.TxRawOutput:
clusterlib_utils.fund_from_faucet(
token_mint_addr,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=300_000_000,
)

Expand All @@ -944,7 +944,7 @@ def _mint_tokens() -> clusterlib.TxRawOutput:
clusterlib_utils.fund_from_faucet(
token_mint_addr,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=40_000_000,
)

Expand Down Expand Up @@ -1662,7 +1662,7 @@ def payment_addrs(
clusterlib_utils.fund_from_faucet(
addrs[0],
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
)

return addrs
Expand Down
4 changes: 2 additions & 2 deletions cardano_node_tests/tests/test_node_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def payment_addr_locked(
clusterlib_utils.fund_from_faucet(
addr,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
)

return addr
Expand All @@ -71,7 +71,7 @@ def payment_addrs_disposable(
clusterlib_utils.fund_from_faucet(
addrs[0],
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
)

return addrs
Expand Down
26 changes: 13 additions & 13 deletions cardano_node_tests/tests/test_pools.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ def test_stake_pool_metadata(
clusterlib_utils.fund_from_faucet(
pool_owners[0].payment,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=900_000_000,
)

Expand Down Expand Up @@ -748,7 +748,7 @@ def test_stake_pool_not_avail_metadata(
clusterlib_utils.fund_from_faucet(
pool_owners[0].payment,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=900_000_000,
)

Expand Down Expand Up @@ -818,7 +818,7 @@ def test_create_stake_pool(
clusterlib_utils.fund_from_faucet(
pool_owners[0].payment,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=900_000_000,
)

Expand Down Expand Up @@ -883,7 +883,7 @@ def test_deregister_stake_pool(
clusterlib_utils.fund_from_faucet(
pool_owners[0].payment,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=900_000_000,
)

Expand Down Expand Up @@ -1024,7 +1024,7 @@ def test_reregister_stake_pool(
clusterlib_utils.fund_from_faucet(
pool_owners[0].payment,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=1_500_000_000,
)

Expand Down Expand Up @@ -1185,7 +1185,7 @@ def test_cancel_stake_pool_deregistration(
clusterlib_utils.fund_from_faucet(
pool_owners[0].payment,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=1_500_000_000,
)

Expand Down Expand Up @@ -1350,7 +1350,7 @@ def test_update_stake_pool_metadata(
clusterlib_utils.fund_from_faucet(
pool_owners[0].payment,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=900_000_000 * no_of_addr,
)

Expand Down Expand Up @@ -1469,7 +1469,7 @@ def test_update_stake_pool_parameters(
clusterlib_utils.fund_from_faucet(
pool_owners[0].payment,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=900_000_000 * no_of_addr,
)

Expand Down Expand Up @@ -1570,7 +1570,7 @@ def test_sign_in_multiple_stages(
clusterlib_utils.fund_from_faucet(
pool_owners[0].payment,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=900_000_000,
)

Expand Down Expand Up @@ -1707,7 +1707,7 @@ def test_pool_registration_deregistration(
clusterlib_utils.fund_from_faucet(
pool_owner.payment,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=900_000_000,
)

Expand Down Expand Up @@ -1813,7 +1813,7 @@ def pool_owners_pbt(
clusterlib_utils.fund_from_faucet(
pool_owners[0].payment,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=900_000_000,
)

Expand Down Expand Up @@ -1896,7 +1896,7 @@ def _subtest(pool_cost: int) -> None:
clusterlib_utils.fund_from_faucet(
pool_owners[0].payment,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=900_000_000,
)

Expand Down Expand Up @@ -1940,7 +1940,7 @@ def pool_users(
clusterlib_utils.fund_from_faucet(
created_users[0],
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
amount=600_000_000,
)

Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_reconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def payment_addrs(
clusterlib_utils.fund_from_faucet(
*addrs,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
)
return addrs

Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_rollback.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def payment_addrs(
clusterlib_utils.fund_from_faucet(
*addrs,
cluster_obj=cluster,
faucet_data=cluster_manager.cache.addrs_data["user1"],
all_faucets=cluster_manager.cache.addrs_data,
)
return addrs

Expand Down
Loading

0 comments on commit 9708c55

Please sign in to comment.