Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

Test annotations #110

Merged
merged 2 commits into from
Jan 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion example.test.env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: <quay application token>
# Robot account in *namespace* with *Creator* team role.
user: <robot account>
# Token for the robot account in the *namespace*.
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'.
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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"])
2 changes: 1 addition & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

Expand Down