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

Commit

Permalink
Test csv_annotations
Browse files Browse the repository at this point in the history
Test if csv_annotations are properly added to CSV metadata (including
package name with suffix)

Signed-off-by: Martin Bašti <mbasti@redhat.com>
  • Loading branch information
MartinBasti committed Jan 29, 2020
1 parent 466f3f4 commit 5d11eaa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions example.test.env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ alter_package_name:
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)

0 comments on commit 5d11eaa

Please sign in to comment.