[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
|
return 1
|
||||||
fi
|
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
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "compose finished"
|
rlPhaseStartTest "compose finished"
|
||||||
if [ -n "$UUID" ]; then
|
wait_for_compose $UUID
|
||||||
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
|
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "Import AMI image in AWS"
|
rlPhaseStartTest "Import AMI image in AWS"
|
||||||
|
@ -67,14 +67,7 @@ rlJournalStart
|
|||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "compose finished"
|
rlPhaseStartTest "compose finished"
|
||||||
if [ -n "$UUID" ]; then
|
wait_for_compose $UUID
|
||||||
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
|
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "Upload image to Azure"
|
rlPhaseStartTest "Upload image to Azure"
|
||||||
|
@ -77,14 +77,7 @@ __EOF__
|
|||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "compose finished"
|
rlPhaseStartTest "compose finished"
|
||||||
if [ -n "$UUID" ]; then
|
wait_for_compose $UUID
|
||||||
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
|
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "Upload QCOW2 image to OpenStack"
|
rlPhaseStartTest "Upload QCOW2 image to OpenStack"
|
||||||
|
@ -98,14 +98,7 @@ __EOF__
|
|||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "compose finished"
|
rlPhaseStartTest "compose finished"
|
||||||
if [ -n "$UUID" ]; then
|
wait_for_compose $UUID
|
||||||
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
|
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "Upload VMDK image in vCenter"
|
rlPhaseStartTest "Upload VMDK image in vCenter"
|
||||||
|
@ -27,15 +27,7 @@ rlJournalStart
|
|||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "compose finished"
|
rlPhaseStartTest "compose finished"
|
||||||
if [ -n "$UUID" ]; then
|
wait_for_compose $UUID
|
||||||
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
|
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartCleanup
|
rlPhaseStartCleanup
|
||||||
|
@ -23,15 +23,7 @@ rlJournalStart
|
|||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStart "compose finished"
|
rlPhaseStart "compose finished"
|
||||||
if [ -n "$UUID" ]; then
|
wait_for_compose $UUID
|
||||||
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
|
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStart "compose check"
|
rlPhaseStart "compose check"
|
||||||
|
@ -30,15 +30,7 @@ rlJournalStart
|
|||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "compose finished"
|
rlPhaseStartTest "compose finished"
|
||||||
if [ -n "$UUID" ]; then
|
wait_for_compose $UUID
|
||||||
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
|
|
||||||
|
|
||||||
rlRun -t -c "$CLI compose image $UUID"
|
rlRun -t -c "$CLI compose image $UUID"
|
||||||
IMAGE="$UUID-live.iso"
|
IMAGE="$UUID-live.iso"
|
||||||
|
@ -27,15 +27,7 @@ rlJournalStart
|
|||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "compose finished"
|
rlPhaseStartTest "compose finished"
|
||||||
if [ -n "$UUID" ]; then
|
wait_for_compose $UUID
|
||||||
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
|
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartCleanup
|
rlPhaseStartCleanup
|
||||||
|
@ -58,16 +58,7 @@ __EOF__
|
|||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "compose finished"
|
rlPhaseStartTest "compose finished"
|
||||||
if [ -n "$UUID" ]; then
|
wait_for_compose $UUID
|
||||||
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
|
|
||||||
|
|
||||||
rlRun -t -c "$CLI compose image $UUID"
|
rlRun -t -c "$CLI compose image $UUID"
|
||||||
IMAGE="$UUID-disk.qcow2"
|
IMAGE="$UUID-disk.qcow2"
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
@ -31,11 +31,8 @@ rlJournalStart
|
|||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "compose image"
|
rlPhaseStartTest "compose image"
|
||||||
|
wait_for_compose $UUID
|
||||||
if [ -n "$UUID" ]; then
|
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"
|
check_compose_status "$UUID"
|
||||||
|
|
||||||
rlRun -t -c "$CLI compose image $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/"
|
||||||
rlAssertExists "/var/lib/lorax/composer/results/$UUID/root.tar.xz"
|
rlAssertExists "/var/lib/lorax/composer/results/$UUID/root.tar.xz"
|
||||||
rlAssertNotDiffer "/var/lib/lorax/composer/results/$UUID/root.tar.xz" "$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
|
fi
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
|
@ -29,15 +29,7 @@ rlJournalStart
|
|||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "compose finished"
|
rlPhaseStartTest "compose finished"
|
||||||
if [ -n "$UUID" ]; then
|
wait_for_compose $UUID
|
||||||
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
|
|
||||||
|
|
||||||
# Running a compose can lead to a different selinux policy in the
|
# Running a compose can lead to a different selinux policy in the
|
||||||
# kernel, which may break docker. Reload the policy from the host and
|
# kernel, which may break docker. Reload the policy from the host and
|
||||||
|
Loading…
Reference in New Issue
Block a user