Skip to content

Commit

Permalink
[integ-tests] Remove test_create_wrong_pcluster_version
Browse files Browse the repository at this point in the history
This test is intentionally using a custom AMI with the wrong ParallelCluster version and expecting error messages in cloud-init-output.log. This test is not stable because as soon as we make major cookbook changes, the error messages might not appear. This integration test was created by me. It really seems superfluous.

Signed-off-by: Hanwen <[email protected]>
  • Loading branch information
hanwen-cluster committed Oct 29, 2024
1 parent 96fad44 commit eb3bd99
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 54 deletions.
6 changes: 0 additions & 6 deletions tests/integration-tests/configs/develop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,6 @@ test-suites:
instances: {{ common.INSTANCES_DEFAULT_X86 }}
oss: ["rhel8"] # os must be different from ubuntu2004 to test os validation logic when wrong os is provided
schedulers: ["slurm"]
test_create.py::test_create_wrong_pcluster_version:
dimensions:
- regions: ["ca-central-1"]
instances: {{ common.INSTANCES_DEFAULT_X86 }}
oss: ["alinux2"]
schedulers: ["slurm"]
test_create.py::test_create_imds_secured:
dimensions:
- regions: ["eu-south-1"]
Expand Down
6 changes: 0 additions & 6 deletions tests/integration-tests/configs/isolated_regions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ test-suites:
# - regions: {{ REGIONS }}
# instances: {{ INSTANCES }}
# oss: {{ OSS }}
# schedulers: {{ SCHEDULERS }}
# test_create.py::test_create_wrong_pcluster_version:
# dimensions:
# - regions: {{ REGIONS }}
# instances: {{ INSTANCES }}
# oss: {{ OSS }}
# schedulers: {{ SCHEDULERS }}
test_create.py::test_create_imds_secured:
dimensions:
Expand Down
6 changes: 0 additions & 6 deletions tests/integration-tests/configs/released.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ test-suites:
instances: {{ common.INSTANCES_DEFAULT_X86 }}
oss: ["rhel8"] # os must be different from ubuntu2004 to test os validation logic when wrong os is provided
schedulers: ["slurm"]
test_create.py::test_create_wrong_pcluster_version:
dimensions:
- regions: ["ca-central-1"]
instances: {{ common.INSTANCES_DEFAULT_X86 }}
oss: ["alinux2"]
schedulers: ["slurm"]
test_create.py::test_create_imds_secured:
dimensions:
- regions: ["eu-south-1"]
Expand Down
37 changes: 1 addition & 36 deletions tests/integration-tests/tests/create/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
assert_head_node_is_running,
assert_lines_in_logs,
)
from tests.common.utils import get_installed_parallelcluster_version, reboot_head_node, retrieve_latest_ami
from tests.common.utils import reboot_head_node, retrieve_latest_ami


@pytest.mark.usefixtures("instance", "scheduler")
Expand All @@ -52,41 +52,6 @@ def test_create_wrong_os(region, os, pcluster_config_reader, clusters_factory, a
)


@pytest.mark.usefixtures("instance", "os", "scheduler")
def test_create_wrong_pcluster_version(
region, pcluster_config_reader, pcluster_ami_without_standard_naming, clusters_factory
):
"""Test error message when AMI provided was baked by a pcluster whose version is different from current version"""
current_version = get_installed_parallelcluster_version()
wrong_version = "3.10.0"
logging.info("Asserting wrong_version is different from current_version")
assert_that(current_version != wrong_version).is_true()
# Retrieve an AMI without 'aws-parallelcluster-<version>' in its name.
# Therefore, we can bypass the version check in CLI and test version check of .bootstrapped file in Cookbook.
wrong_ami = pcluster_ami_without_standard_naming(wrong_version)
cluster_config = pcluster_config_reader(custom_ami=wrong_ami)
cluster = clusters_factory(cluster_config, raise_on_error=False)

assert_head_node_is_running(region, cluster)
remote_command_executor = RemoteCommandExecutor(cluster)

logging.info("Verifying error in logs")
assert_lines_in_logs(
remote_command_executor,
["/var/log/cloud-init-output.log"],
["error_exit", rf"AMI was created.+{wrong_version}.+is.+used.+{current_version}"],
)
logging.info("Verifying failures in describe-clusters output")
expected_failures = [
{
"failureCode": "AmiVersionMismatch",
"failureReason": "ParallelCluster version of the custom AMI is different than the cookbook. Please make "
"them consistent.",
}
]
assert_that(cluster.creation_response.get("failures")).is_equal_to(expected_failures)


@pytest.mark.usefixtures("instance", "scheduler")
@pytest.mark.parametrize(
"imds_secured, users_allow_list",
Expand Down

0 comments on commit eb3bd99

Please sign in to comment.