tests: Add check to make sure the compose actually finished

Previously it was looping, waiting for FINISHED|FAILED but was not
actually failing the test if the compose failed to build.
This adds a function to check the status of the compose and calls it
after each compose.

(cherry picked from commit d0e947fe3b)

Related: rhbz#1724073
This commit is contained in:
Brian C. Lane 2019-07-10 08:58:24 -07:00 committed by Alexander Todorov
parent dcb4c1a0e5
commit ecc1ab705b
8 changed files with 16 additions and 0 deletions

View File

@ -64,3 +64,12 @@ check_kernel_cmdline() {
rlRun -t -c "ssh $SSH_OPTS ${SSH_USER}@${SSH_MACHINE} 'grep custom_cmdline_arg /proc/cmdline'" 0 \ rlRun -t -c "ssh $SSH_OPTS ${SSH_USER}@${SSH_MACHINE} 'grep custom_cmdline_arg /proc/cmdline'" 0 \
"System booted from the image contains specified parameter on kernel command line" "System booted from the image contains specified parameter on kernel command line"
} }
# Fail if the compose failed, only call after checking for FINISHED|FAILED
check_compose_status() {
UUID="$1"
if "$CLI" compose info "$UUID" | grep FAILED; then
rlFail "compose $UUID FAILED"
return 1
fi
}

View File

@ -32,6 +32,7 @@ rlJournalStart
sleep 10 sleep 10
rlLogInfo "Waiting for compose to finish ..." rlLogInfo "Waiting for compose to finish ..."
done; done;
check_compose_status "$UUID"
else else
rlFail "Compose UUID is empty!" rlFail "Compose UUID is empty!"
fi fi

View File

@ -28,6 +28,7 @@ rlJournalStart
sleep 10 sleep 10
rlLogInfo "Waiting for compose to finish..." rlLogInfo "Waiting for compose to finish..."
done done
check_compose_status "$UUID"
else else
flFail "Compose UUID is empty!" flFail "Compose UUID is empty!"
fi fi

View File

@ -36,6 +36,7 @@ rlJournalStart
sleep 20 sleep 20
rlLogInfo "Waiting for compose to finish ..." rlLogInfo "Waiting for compose to finish ..."
done; done;
check_compose_status "$UUID"
else else
rlFail "Compose UUID is empty!" rlFail "Compose UUID is empty!"
fi fi

View File

@ -32,6 +32,7 @@ rlJournalStart
sleep 10 sleep 10
rlLogInfo "Waiting for compose to finish ..." rlLogInfo "Waiting for compose to finish ..."
done; done;
check_compose_status "$UUID"
else else
rlFail "Compose UUID is empty!" rlFail "Compose UUID is empty!"
fi fi

View File

@ -64,6 +64,7 @@ __EOF__
sleep 20 sleep 20
rlLogInfo "Waiting for compose to finish ..." rlLogInfo "Waiting for compose to finish ..."
done; done;
check_compose_status "$UUID"
else else
rlFail "Compose UUID is empty!" rlFail "Compose UUID is empty!"
fi fi

View File

@ -36,6 +36,7 @@ rlJournalStart
sleep 5 sleep 5
rlLogInfo "Waiting for compose to finish ..." rlLogInfo "Waiting for compose to finish ..."
done; done;
check_compose_status "$UUID"
rlRun -t -c "$CLI compose image $UUID" rlRun -t -c "$CLI compose image $UUID"
rlAssertExists "$UUID-root.tar.xz" rlAssertExists "$UUID-root.tar.xz"

View File

@ -34,6 +34,7 @@ rlJournalStart
sleep 10 sleep 10
rlLogInfo "Waiting for compose to finish ..." rlLogInfo "Waiting for compose to finish ..."
done; done;
check_compose_status "$UUID"
else else
rlFail "Compose UUID is empty!" rlFail "Compose UUID is empty!"
fi fi