diff --git a/test/pagila.sh b/test/pagila.sh index 2068de68..36c89a94 100755 --- a/test/pagila.sh +++ b/test/pagila.sh @@ -7,9 +7,9 @@ die() { echo "$*" >&2 ; exit 1; } test -z "$CID" && die "Please specify \$CID variable" # test -d common || die "Please run me from git root directory" -pagila_mirror=https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/p/ +pagila_koji=https://kojipkgs.fedoraproject.org//packages/pagila/0.10.1/3.el7/noarch/ pagila_base="pagila-0.10.1-3.el7.noarch.rpm" -pagila=$pagila_mirror$pagila_base +pagila=$pagila_koji$pagila_base pagila_file="$PWD/postgresql-container-pagila.sql" pagila_sha256sum=b968d9498d866bff8f47d9e50edf49feeff108d4164bff2aa167dc3eae802701 @@ -20,7 +20,7 @@ pagila_sha256sum=b968d9498d866bff8f47d9e50edf49feeff108d4164bff2aa167dc3eae80270 test ! -f "$pagila_file" || exit 0 set -o pipefail - curl -s "$pagila" > "$pagila_base" + curl -s "$pagila" > "$pagila_base" || die "ERROR: Could not download $pagila" for file in ./usr/share/pagila/pagila-schema.sql \ ./usr/share/pagila/pagila-data.sql \ ./usr/share/pagila/pagila-insert-data.sql ; \ diff --git a/test/pg-test-lib.sh b/test/pg-test-lib.sh index bb240df8..3bc6749d 100644 --- a/test/pg-test-lib.sh +++ b/test/pg-test-lib.sh @@ -54,14 +54,19 @@ data_pagila_check () 2' # Deliberately moving heredoc into the container, otherwise it does not work # in podman 1.6.x due to https://bugzilla.redhat.com/show_bug.cgi?id=1827324 - local output=$(docker exec -i "$CID" bash -c "psql -tA </dev/null || : ) - test "$exp_output" = "$output" \ - || error "Unexpected output: '$output', expected: '$exp_output'" + test "$exp_output" = "$output" && return + sleep 1 + done + error "Unexpected output: '$output', expected: '$exp_output', and/or we waited too long" } data_empty_create () @@ -82,11 +87,17 @@ data_empty_check () 3' # Deliberately moving heredoc into the container, otherwise it does not work # in podman 1.6.x due to https://bugzilla.redhat.com/show_bug.cgi?id=1827324 - local output=$(docker exec -i "$CID" bash -c "psql -tA </dev/null || : ) - test "$exp_output" = "$output" || error "Unexpected output '$output'" + test "$exp_output" = "$output" && return + sleep 1 + done + error "Unexpected output '$output', expected: '$exp_output', and/or we waited too long" } # wait_for_postgres CID @@ -105,9 +116,9 @@ wait_for_postgres () output=$(docker exec -i "$cid" bash -c \ "psql -h localhost -tA -c 'select 1;' 2>/dev/null || :") case $output in - 1*) return ;; + 1*) debug "server up" ; return ;; "") ;; - *) echo "$output" ; false ;; + *) debug "server down" ; echo "$output" ; false ;; esac sleep 1 counter=$(( counter + 1 )) diff --git a/test/run_upgrade_test b/test/run_upgrade_test index 9e194981..410d0cdf 100755 --- a/test/run_upgrade_test +++ b/test/run_upgrade_test @@ -29,6 +29,7 @@ background_container () { CID=$(eval "docker run -d $2 $1 $3") test -n "$CID" + info "Started container $CID" >&2 } # run_server DATADIR IMAGE_ID DOCKER_ARGS