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

Commit

Permalink
Merge 79b20d8 into 466f3f4
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBasti committed Jan 29, 2020
2 parents 466f3f4 + 79b20d8 commit 5b17263
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
6 changes: 5 additions & 1 deletion example.test.env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@ 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 credentials with access to the namespace
user: <robot account>
password: <robot token>
# suffix used to alter package names
suffix: "-test-suffix"
# name of the package used for testing
package: int-test
csv_annotations:
test: "package.{package_name}"
# 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,23 @@
from tests.integration.utils import test_env, make_bundle, is_yaml_file


def _test_csv_annotations(quay_bundle, config):
"""
Test if bundle contains configured annotations.
Package name must contain suffix.
"""

package_name = config["package"] + config["suffix"]

substitutions = {
'package_name': package_name,
}

for name, value in config['csv_annotations'].items():
assert name in quay_bundle['metadata']['annotations']
assert quay_bundle['metadata']['annotations'][name] == value.format(**substitutions)


def has(suffix, manifest_path):
"""
Tell if 'suffix' can be found in YAML files under 'manifest_path'.
Expand Down Expand Up @@ -66,6 +83,7 @@ def test_alter_package_name_during_nvr_push(suffix_omps, suffix_quay, koji, tmp_
)

assert quay_bundle["packageName"] == config["package"] + config["suffix"]
_test_csv_annotations(quay_bundle, config)


@pytest.mark.skipif(
Expand Down Expand Up @@ -103,5 +121,5 @@ def test_alter_package_name_during_archive_push(suffix_omps, suffix_quay, tmp_pa
)
)
)

assert quay_bundle["packageName"] == config["package"] + config["suffix"]
_test_csv_annotations(quay_bundle, config)
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

0 comments on commit 5b17263

Please sign in to comment.