[tests] Use a function to wait for compose to finish
The function is meant to replace the duplicate pieces of code used in various tests, the polling interval is unified to 20 seconds.
This commit is contained in:
parent
ea98969014
commit
836f0ddf7a
@ -97,3 +97,18 @@ check_compose_status() {
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Wait until the compose is done (finished or failed)
|
||||
wait_for_compose() {
|
||||
local UUID=$1
|
||||
if [ -n "$UUID" ]; then
|
||||
until $CLI compose info $UUID | grep 'FINISHED\|FAILED'; do
|
||||
sleep 20
|
||||
rlLogInfo "Waiting for compose to finish ..."
|
||||
done;
|
||||
check_compose_status "$UUID"
|
||||
else
|
||||
rlFail "Compose UUID is empty!"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -84,14 +84,7 @@ __EOF__
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "compose finished"
|
||||
if [ -n "$UUID" ]; then
|
||||
until $CLI compose info $UUID | grep 'FINISHED\|FAILED'; do
|
||||
rlLogInfo "Waiting for compose to finish ..."
|
||||
sleep 30
|
||||
done;
|
||||
else
|
||||
rlFail "Compose UUID is empty!"
|
||||
fi
|
||||
wait_for_compose $UUID
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Import AMI image in AWS"
|
||||
|
@ -67,14 +67,7 @@ rlJournalStart
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "compose finished"
|
||||
if [ -n "$UUID" ]; then
|
||||
until $CLI compose info $UUID | grep 'FINISHED\|FAILED'; do
|
||||
rlLogInfo "Waiting for compose to finish ..."
|
||||
sleep 30
|
||||
done;
|
||||
else
|
||||
rlFail "Compose UUID is empty!"
|
||||
fi
|
||||
wait_for_compose $UUID
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Upload image to Azure"
|
||||
|
@ -77,14 +77,7 @@ __EOF__
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "compose finished"
|
||||
if [ -n "$UUID" ]; then
|
||||
until $CLI compose info $UUID | grep 'FINISHED\|FAILED'; do
|
||||
rlLogInfo "Waiting for compose to finish ..."
|
||||
sleep 30
|
||||
done;
|
||||
else
|
||||
rlFail "Compose UUID is empty!"
|
||||
fi
|
||||
wait_for_compose $UUID
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Upload QCOW2 image to OpenStack"
|
||||
|
@ -98,14 +98,7 @@ __EOF__
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "compose finished"
|
||||
if [ -n "$UUID" ]; then
|
||||
until $CLI compose info $UUID | grep 'FINISHED\|FAILED'; do
|
||||
rlLogInfo "Waiting for compose to finish ..."
|
||||
sleep 30
|
||||
done;
|
||||
else
|
||||
rlFail "Compose UUID is empty!"
|
||||
fi
|
||||
wait_for_compose $UUID
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Upload VMDK image in vCenter"
|
||||
|
@ -27,15 +27,7 @@ rlJournalStart
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "compose finished"
|
||||
if [ -n "$UUID" ]; then
|
||||
until $CLI compose info $UUID | grep 'FINISHED\|FAILED'; do
|
||||
sleep 10
|
||||
rlLogInfo "Waiting for compose to finish ..."
|
||||
done;
|
||||
check_compose_status "$UUID"
|
||||
else
|
||||
rlFail "Compose UUID is empty!"
|
||||
fi
|
||||
wait_for_compose $UUID
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
|
@ -23,15 +23,7 @@ rlJournalStart
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStart "compose finished"
|
||||
if [ -n "$UUID" ]; then
|
||||
until $CLI compose info $UUID | grep 'FINISHED\|FAILED'; do
|
||||
sleep 10
|
||||
rlLogInfo "Waiting for compose to finish..."
|
||||
done
|
||||
check_compose_status "$UUID"
|
||||
else
|
||||
flFail "Compose UUID is empty!"
|
||||
fi
|
||||
wait_for_compose $UUID
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStart "compose check"
|
||||
|
@ -30,15 +30,7 @@ rlJournalStart
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "compose finished"
|
||||
if [ -n "$UUID" ]; then
|
||||
until $CLI compose info $UUID | grep 'FINISHED\|FAILED'; do
|
||||
sleep 20
|
||||
rlLogInfo "Waiting for compose to finish ..."
|
||||
done;
|
||||
check_compose_status "$UUID"
|
||||
else
|
||||
rlFail "Compose UUID is empty!"
|
||||
fi
|
||||
wait_for_compose $UUID
|
||||
|
||||
rlRun -t -c "$CLI compose image $UUID"
|
||||
IMAGE="$UUID-live.iso"
|
||||
|
@ -27,15 +27,7 @@ rlJournalStart
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "compose finished"
|
||||
if [ -n "$UUID" ]; then
|
||||
until $CLI compose info $UUID | grep 'FINISHED\|FAILED'; do
|
||||
sleep 10
|
||||
rlLogInfo "Waiting for compose to finish ..."
|
||||
done;
|
||||
check_compose_status "$UUID"
|
||||
else
|
||||
rlFail "Compose UUID is empty!"
|
||||
fi
|
||||
wait_for_compose $UUID
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
|
@ -58,16 +58,7 @@ __EOF__
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "compose finished"
|
||||
if [ -n "$UUID" ]; then
|
||||
until $CLI compose info $UUID | grep 'FINISHED\|FAILED'; do
|
||||
sleep 20
|
||||
rlLogInfo "Waiting for compose to finish ..."
|
||||
done;
|
||||
check_compose_status "$UUID"
|
||||
else
|
||||
rlFail "Compose UUID is empty!"
|
||||
fi
|
||||
|
||||
wait_for_compose $UUID
|
||||
rlRun -t -c "$CLI compose image $UUID"
|
||||
IMAGE="$UUID-disk.qcow2"
|
||||
rlPhaseEnd
|
||||
|
@ -31,11 +31,8 @@ rlJournalStart
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "compose image"
|
||||
wait_for_compose $UUID
|
||||
if [ -n "$UUID" ]; then
|
||||
until $CLI compose info $UUID | grep 'FINISHED\|FAILED'; do
|
||||
sleep 5
|
||||
rlLogInfo "Waiting for compose to finish ..."
|
||||
done;
|
||||
check_compose_status "$UUID"
|
||||
|
||||
rlRun -t -c "$CLI compose image $UUID"
|
||||
@ -45,8 +42,6 @@ rlJournalStart
|
||||
rlAssertExists "/var/lib/lorax/composer/results/$UUID/"
|
||||
rlAssertExists "/var/lib/lorax/composer/results/$UUID/root.tar.xz"
|
||||
rlAssertNotDiffer "/var/lib/lorax/composer/results/$UUID/root.tar.xz" "$UUID-root.tar.xz"
|
||||
else
|
||||
rlFail "Compose UUID is empty!"
|
||||
fi
|
||||
rlPhaseEnd
|
||||
|
||||
|
@ -29,15 +29,7 @@ rlJournalStart
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "compose finished"
|
||||
if [ -n "$UUID" ]; then
|
||||
until $CLI compose info $UUID | grep 'FINISHED\|FAILED'; do
|
||||
sleep 10
|
||||
rlLogInfo "Waiting for compose to finish ..."
|
||||
done;
|
||||
check_compose_status "$UUID"
|
||||
else
|
||||
rlFail "Compose UUID is empty!"
|
||||
fi
|
||||
wait_for_compose $UUID
|
||||
|
||||
# Running a compose can lead to a different selinux policy in the
|
||||
# kernel, which may break docker. Reload the policy from the host and
|
||||
|
Loading…
Reference in New Issue
Block a user