Skip to content

Commit e74e72a

Browse files
authored
Merge pull request #3036 from IntersectMBO/add_cluster_metadata
feat(configuration): add cluster info metadata
2 parents 20288a4 + 50c5f20 commit e74e72a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

cardano_node_tests/tests/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ def pytest_configure(config: tp.Any) -> None:
102102
config.stash[metadata_key]["MIXED_P2P"] = str(configuration.MIXED_P2P)
103103
config.stash[metadata_key]["NUM_POOLS"] = str(configuration.NUM_POOLS)
104104
config.stash[metadata_key]["UTXO_BACKEND"] = configuration.UTXO_BACKEND
105+
config.stash[metadata_key]["MAX_TESTS_PER_CLUSTER"] = configuration.MAX_TESTS_PER_CLUSTER
106+
# If not explicitly specified, the `CLUSTERS_COUNT` is calculated based on number of xdist
107+
# workers, which is not known yet by the time this fixture runs.
108+
if os.environ.get("CLUSTERS_COUNT") is not None:
109+
config.stash[metadata_key]["CLUSTERS_COUNT"] = configuration.CLUSTERS_COUNT
105110
if configuration.CONFIRM_BLOCKS_NUM:
106111
config.stash[metadata_key]["CONFIRM_BLOCKS_NUM"] = str(configuration.CONFIRM_BLOCKS_NUM)
107112
config.stash[metadata_key]["HAS_CC"] = str(configuration.HAS_CC)

cardano_node_tests/utils/configuration.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@
5757
msg = f"Invalid COMMAND_ERA: {COMMAND_ERA}"
5858
raise RuntimeError(msg)
5959

60-
CLUSTERS_COUNT = int(os.environ.get("CLUSTERS_COUNT") or 0)
61-
WORKERS_COUNT = int(os.environ.get("PYTEST_XDIST_WORKER_COUNT") or 1)
60+
XDIST_WORKERS_COUNT = int(os.environ.get("PYTEST_XDIST_WORKER_COUNT") or 0)
6261
MAX_TESTS_PER_CLUSTER = int(os.environ.get("MAX_TESTS_PER_CLUSTER") or 8)
63-
CLUSTERS_COUNT = int(CLUSTERS_COUNT or (min(WORKERS_COUNT, 9)))
62+
# If CLUSTERS_COUNT is not set, use the number of xdist workers or 1
63+
CLUSTERS_COUNT = int(os.environ.get("CLUSTERS_COUNT") or 0)
64+
CLUSTERS_COUNT = int(CLUSTERS_COUNT or (min(XDIST_WORKERS_COUNT, 9)) or 1)
6465

6566
DEV_CLUSTER_RUNNING = bool(os.environ.get("DEV_CLUSTER_RUNNING"))
6667
FORBID_RESTART = bool(os.environ.get("FORBID_RESTART"))

0 commit comments

Comments
 (0)