From 9a7fd6536cfa45044055494372c97607b98f530a Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Wed, 4 Sep 2024 08:37:18 +0200 Subject: [PATCH] add test for container push on Katello 4.14+ --- bats/fb-katello-container.bats | 10 ++++++++++ bats/foreman_helper.bash | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/bats/fb-katello-container.bats b/bats/fb-katello-container.bats index 1882cd7a7..e31505200 100644 --- a/bats/fb-katello-container.bats +++ b/bats/fb-katello-container.bats @@ -13,3 +13,13 @@ load fixtures/content CONTAINER_PULL_LABEL=$(echo "${ORGANIZATION_LABEL}-${PRODUCT_LABEL}-${CONTAINER_REPOSITORY_LABEL}"| tr '[:upper:]' '[:lower:]') podman pull "${HOSTNAME}/${CONTAINER_PULL_LABEL}" } + +@test "push container to katello" { + tContainerPushSupported + tPackageExists podman || tPackageInstall podman + podman login "${HOSTNAME}" -u admin -p changeme + CONTAINER_PULL_LABEL=$(echo "${ORGANIZATION_LABEL}-${PRODUCT_LABEL}-${CONTAINER_REPOSITORY_LABEL}"| tr '[:upper:]' '[:lower:]') + CONTAINER_PUSH_LABEL=$(echo "${ORGANIZATION_LABEL}/${PRODUCT_LABEL}/${CONTAINER_REPOSITORY_LABEL}-bats-$(date -u '+%s')"| tr '[:upper:]' '[:lower:]') + podman push "${HOSTNAME}/${CONTAINER_PULL_LABEL}" "${HOSTNAME}/${CONTAINER_PUSH_LABEL}" + podman search "${HOSTNAME}/" | grep -q "${CONTAINER_PUSH_LABEL}" +} diff --git a/bats/foreman_helper.bash b/bats/foreman_helper.bash index 5a81a3b87..f69566a30 100644 --- a/bats/foreman_helper.bash +++ b/bats/foreman_helper.bash @@ -46,6 +46,13 @@ tSkipIfOlderThan43() { fi } +tContainerPushSupported() { + KATELLO_VERSION=$(tKatelloVersion) + if ! tIsVersionNewer "${KATELLO_VERSION}" 4.14; then + skip "Container push is only supported on Katello 4.14+" + fi +} + tIsPulp2() { tPackageExists pulp-server }