diff --git a/example.test.env.yaml b/example.test.env.yaml index ff27ba7..ea717d6 100644 --- a/example.test.env.yaml +++ b/example.test.env.yaml @@ -49,7 +49,9 @@ replace_registry: # Config of the instance tested to alter package names. alter_package_name: # namespace in which package names should be altered - namespace: integration-tests + namespace: integration-tests-with-suffix + # oauth token for integration-tests-with-suffix namespace + quay_oauth_token: # Robot account in *namespace* with *Creator* team role. user: # Token for the robot account in the *namespace*. @@ -58,6 +60,8 @@ alter_package_name: suffix: "-test-suffix" # name of the package used for testing package: int-test + csv_annotations: + test: "package.int-test-test-suffix" # Config of the instance tested to check if Greenwave policies are met for the # NVR greenwave: diff --git a/tests/integration/alter_package_names/alter_package_names_test.py b/tests/integration/alter_package_names/alter_package_names_test.py index 98627a8..1561e71 100644 --- a/tests/integration/alter_package_names/alter_package_names_test.py +++ b/tests/integration/alter_package_names/alter_package_names_test.py @@ -11,6 +11,17 @@ from tests.integration.utils import test_env, make_bundle, is_yaml_file +def check_csv_annotations(quay_bundle, expected_annotations): + """ + Test if bundle contains expected annotations + """ + + for name, value in expected_annotations.items(): + annotations = quay_bundle['metadata']['annotations'] + assert name in annotations + assert annotations[name] == value + + def has(suffix, manifest_path): """ Tell if 'suffix' can be found in YAML files under 'manifest_path'. @@ -67,6 +78,8 @@ def test_alter_package_name_during_nvr_push(suffix_omps, suffix_quay, koji, tmp_ assert quay_bundle["packageName"] == config["package"] + config["suffix"] + check_csv_annotations(quay_bundle, config["csv_annotations"]) + @pytest.mark.skipif( not test_env.get("alter_package_name"), @@ -103,5 +116,6 @@ def test_alter_package_name_during_archive_push(suffix_omps, suffix_quay, tmp_pa ) ) ) - assert quay_bundle["packageName"] == config["package"] + config["suffix"] + + check_csv_annotations(quay_bundle, config["csv_annotations"]) diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 23709a0..413c837 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -80,7 +80,7 @@ def suffix_quay(): if config: quay = QuayAppRegistry(test_env["quay_app_registry_api"], test_env["quay_api"], - test_env["quay_oauth_token"]) + config["quay_oauth_token"]) quay.login_to_cnr(config["user"], config["password"])