From 0508a7ad1b21622cd7042f05b5cbf1b3a492903e Mon Sep 17 00:00:00 2001 From: Jakub Rusz Date: Fri, 5 Nov 2021 09:15:23 +0100 Subject: [PATCH] tests: run ostree.sh tests on fedora and centos When tools/define-compose-url.sh was sourced the tests were skipped if they were not running on rhel. Also change the BOOT_LOCATION for centos-8. --- test/cases/ostree.sh | 16 ++++++++++------ tools/define-compose-url.sh | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/test/cases/ostree.sh b/test/cases/ostree.sh index e2760fca7..3caa37547 100755 --- a/test/cases/ostree.sh +++ b/test/cases/ostree.sh @@ -1,11 +1,14 @@ #!/bin/bash set -euo pipefail -source /usr/libexec/osbuild-composer-test/define-compose-url.sh - # Get OS data. source /usr/libexec/osbuild-composer-test/set-env-variables.sh +# Get compose url if it's running on unsubscried RHEL +if [[ ${ID} == "rhel" ]] && ! sudo subscription-manager status; then + source /usr/libexec/osbuild-composer-test/define-compose-url.sh +fi + # Provision the software under test. /usr/libexec/osbuild-composer-test/provision.sh @@ -30,28 +33,29 @@ case "${ID}-${VERSION_ID}" in OSTREE_REF="rhel/8/${ARCH}/edge" OS_VARIANT="rhel8-unknown" USER_IN_COMMIT="true" - BOOT_LOCATION="$COMPOSE_URL/compose/BaseOS/x86_64/os/" + BOOT_LOCATION="${COMPOSE_URL:-}/compose/BaseOS/x86_64/os/" ;; "rhel-9.0") IMAGE_TYPE=edge-commit OSTREE_REF="rhel/9/${ARCH}/edge" OS_VARIANT="rhel9.0" USER_IN_COMMIT="true" - BOOT_LOCATION="$COMPOSE_URL/compose/BaseOS/x86_64/os/" + BOOT_LOCATION="${COMPOSE_URL:-}/compose/BaseOS/x86_64/os/" ;; "centos-8") IMAGE_TYPE=edge-commit OSTREE_REF="centos/8/${ARCH}/edge" OS_VARIANT="centos8" USER_IN_COMMIT="true" - BOOT_LOCATION="$COMPOSE_URL/compose/BaseOS/x86_64/os/" + BOOT_LOCATION="http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/" ;; "centos-9") IMAGE_TYPE=edge-commit OSTREE_REF="centos/9/${ARCH}/edge" OS_VARIANT="centos9" USER_IN_COMMIT="true" - BOOT_LOCATION="$COMPOSE_URL/compose/BaseOS/x86_64/os/" + # This should be changed once we get centos-9 runners + BOOT_LOCATION="${COMPOSE_URL:-}/compose/BaseOS/x86_64/os/" ;; *) echo "unsupported distro: ${ID}-${VERSION_ID}" diff --git a/tools/define-compose-url.sh b/tools/define-compose-url.sh index b75bc8728..3a799cbc2 100755 --- a/tools/define-compose-url.sh +++ b/tools/define-compose-url.sh @@ -4,7 +4,7 @@ source /etc/os-release # This isn't needed when not running on RHEL if [[ $ID != rhel ]]; then - exit 0 + return 0 fi if [[ $ID == rhel && ${VERSION_ID%.*} == 8 ]]; then