From b9e5fa5e7ba883fb03c0ca3ba56d560a2569094f Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Fri, 24 Jul 2020 12:53:29 +0300 Subject: [PATCH] tests: Allow skipping image build in compose sanity test when $SKIP_IMAGE_BUILD is set the test skips 2 phases: - start the compose again (after it has been cancelled) and - waiting for it to finish & downloading the resulting image This will allow to enable this test script in downstream gating jobs. Cherry-picked from cc29b996591d74e05c31a9b28febbef75713055e, https://github.com/weldr/lorax/pull/1053/ Related: rhbz#1825190 --- tests/cli/test_compose_sanity.sh | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/tests/cli/test_compose_sanity.sh b/tests/cli/test_compose_sanity.sh index b12a9579..ba332e8b 100755 --- a/tests/cli/test_compose_sanity.sh +++ b/tests/cli/test_compose_sanity.sh @@ -59,10 +59,10 @@ rlJournalStart until $CLI compose info $UUID | grep 'RUNNING'; do sleep 20 rlLogInfo "Waiting for compose to start running..." - if $CLI compose info $UUID | grep 'FAILED'; then - rlFail "Compose FAILED!" - break - fi + if $CLI compose info $UUID | grep 'FAILED'; then + rlFail "Compose FAILED!" + break + fi done; else rlFail "Compose UUID is empty!" @@ -76,6 +76,7 @@ rlJournalStart fi rlPhaseEnd +if [ -z "$SKIP_IMAGE_BUILD" ]; then rlPhaseStartTest "compose start again" UUID=`$CLI compose start test-http-server qcow2` rlAssertEquals "exit code should be zero" $? 0 @@ -83,14 +84,6 @@ rlJournalStart UUID=`echo $UUID | cut -f 2 -d' '` rlPhaseEnd - rlPhaseStartTest "compose info" - if [ -n "$UUID" ]; then - rlRun -t -c "$CLI compose info $UUID | egrep 'RUNNING|WAITING'" - else - rlFail "Compose UUID is empty!" - fi - rlPhaseEnd - rlPhaseStartTest "compose image" wait_for_compose $UUID if [ -n "$UUID" ]; then @@ -107,9 +100,14 @@ rlJournalStart rlAssertNotDiffer "/var/lib/lorax/composer/results/$UUID/disk.qcow2" "$UUID-disk.qcow2" fi rlPhaseEnd +else + rlLogInfo "Skipping image build phases" +fi rlPhaseStartCleanup - rlRun -t -c "$CLI compose delete $UUID" + if [ "$($CLI compose list | grep -c $UUID)" == "1" ]; then + rlRun -t -c "$CLI compose delete $UUID" + fi rlPhaseEnd rlJournalEnd