diff --git a/test.sh b/test.sh index 8c9ed4d..0463b04 100755 --- a/test.sh +++ b/test.sh @@ -51,7 +51,7 @@ test_run() { banner '*' "Standard automatic upgrade of PostgreSQL from version ${VERSION} to ${TARGET} SUCCEEDED!" fi - # Shut down containers from previous test runs + # Shut down any containers that are still running docker compose -f docker-compose-pgauto.yml down ## @@ -65,6 +65,21 @@ test_run() { # Create the PostgreSQL database using a specific version of PostgreSQL docker compose -f "docker-compose-pg${VERSION}.yml" run --rm --remove-orphans server create_db + # Run the PostgreSQL container in one shot mode + TARGET_TAG="${TARGET}-${FLAVOR}" docker compose -f docker-compose-pgauto.yml run --rm --remove-orphans \ + -e PGAUTO_ONESHOT=yes postgres + + # Verify the PostgreSQL data files are now the target version + PGVER=$(sudo cat postgres-data/PG_VERSION) + if [ "$PGVER" != "${TARGET}" ]; then + banner '*' "'One shot' automatic upgrade of PostgreSQL from version ${VERSION} to ${TARGET} FAILED!" + FAILURE=1 + else + banner '*' "'One shot' automatic upgrade of PostgreSQL from version ${VERSION} to ${TARGET} SUCCEEDED!" + fi + + # Shut down any containers that are still running + docker compose -f docker-compose-pgauto.yml down # If running on CI, delete the Postgres Docker image to avoid space problems if [ -n "$CI" ]; then