Skip to content

Commit

Permalink
Use newer container naming in container BATS
Browse files Browse the repository at this point in the history
  • Loading branch information
ianballou committed Nov 25, 2024
1 parent 165864c commit 81184e2
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
26 changes: 26 additions & 0 deletions bats/fb-katello-container.bats
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,25 @@ load foreman_helper
load fixtures/content

@test "try fetching container content" {
tContainerSlashesNotDefault
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:]')
podman pull "${HOSTNAME}/${CONTAINER_PULL_LABEL}"
}

@test "try fetching container content with newer naming" {
tContainerSlashesDefault
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:]')
podman pull "${HOSTNAME}/${CONTAINER_PULL_LABEL}"
}

@test "push container to katello" {
skip "Skipping until transient search failure issue is resolved"
tContainerPushSupported
tContainerSlashesNotDefault
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:]')
Expand All @@ -28,3 +38,19 @@ load fixtures/content
sleep 5
podman search "${HOSTNAME}/" | grep -q "${CONTAINER_PUSH_LABEL}"
}

@test "push container to katello with newer naming" {
skip "Skipping until transient search failure issue is resolved"
tContainerPushSupported
tContainerSlashesDefault
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 "${CONTAINER_PULL_LABEL}-bats-$(date -u '+%s')"| tr '[:upper:]' '[:lower:]')
podman push "${HOSTNAME}/${CONTAINER_PULL_LABEL}" "${HOSTNAME}/${CONTAINER_PUSH_LABEL}"
# Sleep for 5 seconds due to an intermittent issue where pushed content
# is not immediately searchable via podman search.
# See https://github.com/theforeman/forklift/pull/1864 for more information.
sleep 5
podman search "${HOSTNAME}/" | grep -q "${CONTAINER_PUSH_LABEL}"
}
18 changes: 16 additions & 2 deletions bats/foreman_helper.bash
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,22 @@ tSkipIfOlderThan43() {

tContainerPushSupported() {
KATELLO_VERSION=$(tKatelloVersion)
if ! tIsVersionNewer "${KATELLO_VERSION}" 4.15; then
skip "Container push is only supported on Katello 4.15+"
if ! tIsVersionNewer "${KATELLO_VERSION}" 4.14; then
skip "Container push is only supported on Katello 4.14+"
fi
}

tContainerSlashesDefault() {
KATELLO_VERSION=$(tKatelloVersion)
if ! tIsVersionNewer "${KATELLO_VERSION}" 4.16; then
skip "Container names have slashes by default only on Katello 4.16+"
fi
}

tContainerSlashesNotDefault() {
KATELLO_VERSION=$(tKatelloVersion)
if tIsVersionNewer "${KATELLO_VERSION}" 4.16; then
skip "Container names have slashes by default only on Katello 4.16+"
fi
}

Expand Down

0 comments on commit 81184e2

Please sign in to comment.