Skip to content

Commit

Permalink
Refactor devops_cluster to cleanly support more cluster types
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoura committed Jan 26, 2021
1 parent 1eb80bd commit fee69ff
Show file tree
Hide file tree
Showing 13 changed files with 220 additions and 164 deletions.
4 changes: 2 additions & 2 deletions cardano_node_tests/tests/conftest.py
Expand Up @@ -10,8 +10,8 @@
from _pytest.tmpdir import TempdirFactory
from xdist import workermanage

from cardano_node_tests.utils import cluster_nodes
from cardano_node_tests.utils import clusterlib
from cardano_node_tests.utils import devops_cluster
from cardano_node_tests.utils import helpers
from cardano_node_tests.utils import parallel_run

Expand Down Expand Up @@ -100,7 +100,7 @@ def _stop_all_cluster_instances(
# save environment info for Allure
helpers.save_env_for_allure(pytest_config)
# save artifacts
devops_cluster.save_artifacts(pytest_tmp_dir=pytest_tmp_dir, pytest_config=pytest_config)
cluster_nodes.save_artifacts(pytest_tmp_dir=pytest_tmp_dir, pytest_config=pytest_config)


@pytest.fixture(scope="session")
Expand Down
6 changes: 3 additions & 3 deletions cardano_node_tests/tests/test_configuration.py
Expand Up @@ -9,8 +9,8 @@
from _pytest.tmpdir import TempdirFactory

from cardano_node_tests.utils import cluster_instances
from cardano_node_tests.utils import cluster_nodes
from cardano_node_tests.utils import clusterlib
from cardano_node_tests.utils import devops_cluster
from cardano_node_tests.utils import helpers
from cardano_node_tests.utils import parallel_run

Expand Down Expand Up @@ -45,7 +45,7 @@ def epoch_length_start_cluster(tmp_path_factory: TempdirFactory) -> Path:
if destdir_ls:
return destdir_ls[0]

startup_files = devops_cluster.copy_startup_files(destdir=destdir)
startup_files = cluster_nodes.CLUSTER_TYPE.copy_startup_files(destdir=destdir)
with open(startup_files.genesis_spec) as fp_in:
genesis_spec = json.load(fp_in)

Expand All @@ -72,7 +72,7 @@ def slot_length_start_cluster(tmp_path_factory: TempdirFactory) -> Path:
if destdir_ls:
return destdir_ls[0]

startup_files = devops_cluster.copy_startup_files(destdir=destdir)
startup_files = cluster_nodes.CLUSTER_TYPE.copy_startup_files(destdir=destdir)
with open(startup_files.genesis_spec) as fp_in:
genesis_spec = json.load(fp_in)

Expand Down
10 changes: 5 additions & 5 deletions cardano_node_tests/tests/test_kes.py
Expand Up @@ -11,9 +11,9 @@
from _pytest.tmpdir import TempdirFactory

from cardano_node_tests.utils import cluster_instances
from cardano_node_tests.utils import cluster_nodes
from cardano_node_tests.utils import clusterlib
from cardano_node_tests.utils import clusterlib_utils
from cardano_node_tests.utils import devops_cluster
from cardano_node_tests.utils import helpers
from cardano_node_tests.utils import logfiles
from cardano_node_tests.utils import parallel_run
Expand Down Expand Up @@ -54,7 +54,7 @@ def short_kes_start_cluster(tmp_path_factory: TempdirFactory) -> Path:
if destdir_ls:
return destdir_ls[0]

startup_files = devops_cluster.copy_startup_files(destdir=destdir)
startup_files = cluster_nodes.CLUSTER_TYPE.copy_startup_files(destdir=destdir)
with open(startup_files.genesis_spec) as fp_in:
genesis_spec = json.load(fp_in)

Expand Down Expand Up @@ -172,7 +172,7 @@ def _wait_epoch_chores(this_epoch: int):
# restart the node with the new operational certificate
logfiles.add_ignore_rule("*.stdout", "MuxBearerClosed")
shutil.copy(invalid_opcert_file, opcert_file)
devops_cluster.restart_node(node_name)
cluster_nodes.restart_node(node_name)

LOGGER.info("Checking blocks production for 5 epochs.")
this_epoch = -1
Expand All @@ -198,7 +198,7 @@ def _wait_epoch_chores(this_epoch: int):
)
# copy the new certificate and restart the node
shutil.move(str(valid_opcert_file), str(opcert_file))
devops_cluster.restart_node(node_name)
cluster_nodes.restart_node(node_name)

LOGGER.info("Checking blocks production for another 3 epochs.")
for __ in range(5):
Expand Down Expand Up @@ -250,7 +250,7 @@ def test_update_valid_opcert(
# restart the node with the new operational certificate
logfiles.add_ignore_rule("*.stdout", "MuxBearerClosed")
shutil.copy(new_opcert_file, opcert_file)
devops_cluster.restart_node(node_name)
cluster_nodes.restart_node(node_name)

LOGGER.info("Checking blocks production for 5 epochs.")
this_epoch = -1
Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_native_tokens.py
Expand Up @@ -25,7 +25,7 @@
from cardano_node_tests.utils import clusterlib_utils
from cardano_node_tests.utils import helpers
from cardano_node_tests.utils import parallel_run
from cardano_node_tests.utils.devops_cluster import VERSIONS
from cardano_node_tests.utils.cluster_nodes import VERSIONS

LOGGER = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions cardano_node_tests/tests/test_pools.py
Expand Up @@ -18,9 +18,9 @@
import pytest
from _pytest.tmpdir import TempdirFactory

from cardano_node_tests.utils import cluster_nodes
from cardano_node_tests.utils import clusterlib
from cardano_node_tests.utils import clusterlib_utils
from cardano_node_tests.utils import devops_cluster
from cardano_node_tests.utils import helpers
from cardano_node_tests.utils import parallel_run

Expand Down Expand Up @@ -55,7 +55,7 @@ def pool_cost_start_cluster(tmp_path_factory: TempdirFactory) -> Path:
if destdir_ls:
return destdir_ls[0]

startup_files = devops_cluster.copy_startup_files(destdir=destdir)
startup_files = cluster_nodes.CLUSTER_TYPE.copy_startup_files(destdir=destdir)
with open(startup_files.genesis_spec) as fp_in:
genesis_spec = json.load(fp_in)

Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_scripts.py
Expand Up @@ -21,7 +21,7 @@
from cardano_node_tests.utils import clusterlib_utils
from cardano_node_tests.utils import helpers
from cardano_node_tests.utils import parallel_run
from cardano_node_tests.utils.devops_cluster import VERSIONS
from cardano_node_tests.utils.cluster_nodes import VERSIONS

LOGGER = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_staking.py
Expand Up @@ -14,7 +14,7 @@
from cardano_node_tests.utils import clusterlib_utils
from cardano_node_tests.utils import helpers
from cardano_node_tests.utils import parallel_run
from cardano_node_tests.utils.devops_cluster import VERSIONS
from cardano_node_tests.utils.cluster_nodes import VERSIONS

LOGGER = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_transactions.py
Expand Up @@ -30,7 +30,7 @@
from cardano_node_tests.utils import clusterlib_utils
from cardano_node_tests.utils import helpers
from cardano_node_tests.utils import parallel_run
from cardano_node_tests.utils.devops_cluster import VERSIONS
from cardano_node_tests.utils.cluster_nodes import VERSIONS

LOGGER = logging.getLogger(__name__)
DATA_DIR = Path(__file__).parent / "data"
Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/utils/cluster_instances.py
@@ -1,4 +1,4 @@
"""Functionality for setting up new DevOps cluster instance."""
"""Functionality for setting up new cluster instance."""
import logging
import os
import re
Expand Down

0 comments on commit fee69ff

Please sign in to comment.