Skip to content

Commit 3cc5f71

Browse files
committed
Add a test suggested in PR where we added pipefail
#521
1 parent 6a32fc1 commit 3cc5f71

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/run_migration_test

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,17 @@ assert_migration_succeeds ()
5353
container_from= container_to=
5454
}
5555

56+
# test case suggested in https://github.com/sclorg/postgresql-container/pull/521
57+
assert_migration_fails()
58+
{
59+
docker run --rm -e POSTGRESQL_MIGRATION_REMOTE_HOST=invalid-host-name -e POSTGRESQL_MIGRATION_ADMIN_PASSWORD=password "$image_to" run-postgresql --version
60+
if [ $? -eq 0 ] ; then
61+
info "The image existed with 0 despite migration obviously did not work, that's a problem."
62+
return 1
63+
else
64+
info "The image existed with non-zero exit code when migration obviously did not work, which is correct"
65+
fi
66+
}
67+
5668
assert_migration_succeeds pagila
69+
assert_migration_fails

0 commit comments

Comments
 (0)