Remove hardcoded sleep 600 and check Jenkins instead
This commit is contained in:
parent
4a96ff5c4d
commit
ec9f5f4022
|
@ -37,17 +37,13 @@ test_rollback() {
|
|||
assertEquals "Should be UL 2" 2 "$correctUL"
|
||||
|
||||
# upload borked update level to backend
|
||||
sleep 10
|
||||
|
||||
echo "UPLOAD BORKED UL, FFS"
|
||||
echo "UPLOADING BROKEN UPDATE LEVEL (MISSING CREDENTIALS PLUGIN)"
|
||||
upload_update_level "./tests/rollback/2-ingest-borked.json"
|
||||
|
||||
# wait enough until upgrade happens, then rollback: check UL is the same as before
|
||||
wait_for_jenkins
|
||||
|
||||
# FIXME: fixed sleep time is crappy
|
||||
sleep 600
|
||||
assertEquals "Should be UL 2" 2 "$correctUL"
|
||||
now=$( date --iso-8601=seconds )
|
||||
echo "Waiting for Jenkins to restart a first time to broken UL3, then back to UL2 (using logs --since=$now)"
|
||||
wait_for_jenkins "$now"
|
||||
|
||||
# let's now check the upload and upgrade attempt to borked UL3 *actually* happened
|
||||
# because if this didn't, then we'd still on UL2, but not testing there was a rollback somewhere
|
||||
|
|
|
@ -19,6 +19,8 @@ oneTimeSetUp() {
|
|||
# shellcheck disable=SC2119
|
||||
upload_update_level
|
||||
|
||||
# (parameter for ingest file name *is* optional)
|
||||
# shellcheck disable=SC2119
|
||||
wait_for_jenkins
|
||||
# shellcheck disable=SC2016
|
||||
JENKINS_HOME="$( docker exec "$container_under_test" bash -c 'echo $JENKINS_HOME' )"
|
||||
|
|
|
@ -104,6 +104,14 @@ wait_for_jenkins() {
|
|||
echo "Running containers (beware, ideally there should be none to avoid issues)"
|
||||
determine_container_name
|
||||
|
||||
if [[ -n $1 ]]; then
|
||||
echo "Looking at docker logs since $1"
|
||||
SINCE="--since=$1"
|
||||
else
|
||||
echo "Looking at docker logs from the beginning"
|
||||
SINCE=""
|
||||
fi
|
||||
|
||||
# FIXME: have to wait pretty long because plugin installations
|
||||
# Possibly we'll want a special mode to accelerate testing, maybe by downloading plugins
|
||||
# from a local cache by overriding JENKINS_UC?
|
||||
|
@ -112,7 +120,7 @@ wait_for_jenkins() {
|
|||
while true
|
||||
do
|
||||
cur_attempts=$(( cur_attempts + 1 ))
|
||||
if ( docker logs $container_under_test | grep "Jenkins is fully up and running" ); then
|
||||
if ( docker logs $SINCE $container_under_test | grep "Jenkins is fully up and running" ); then
|
||||
info "Jenkins has started."
|
||||
break;
|
||||
elif (( $cur_attempts > $max_attempts )); then
|
||||
|
|
Loading…
Reference in New Issue