Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1d3c8f7

Browse files
committedJan 4, 2024
Check that we still work with previous data when changing password
Fix also postgresql_cmd function that is often called with interactive input using <<< but podman run is run in non-interactive mode, resulting in the SQL commands to not proceed and this issue being ignored.
1 parent 62a0e88 commit 1d3c8f7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎test/run_test

+6-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function get_ip_from_cid() {
107107
}
108108

109109
function postgresql_cmd() {
110-
docker run --rm -e PGPASSWORD="$PASS" "$IMAGE_NAME" psql "postgresql://$PGUSER@$CONTAINER_IP:5432/${DB-db}" "$@"
110+
docker run --rm -i -e PGPASSWORD="$PASS" "$IMAGE_NAME" psql -v ON_ERROR_STOP=1 "postgresql://$PGUSER@$CONTAINER_IP:5432/${DB-db}" "$@"
111111
}
112112

113113
function test_connection() {
@@ -138,7 +138,7 @@ function test_connection() {
138138
function test_postgresql() {
139139
local ret=0
140140
echo " Testing PostgreSQL"
141-
postgresql_cmd <<< "CREATE EXTENSION 'uuid-ossp';" || ret=1 # to test contrib package
141+
postgresql_cmd <<< "CREATE EXTENSION \"uuid-ossp\";" || ret=1 # to test contrib package
142142
postgresql_cmd <<< "CREATE TABLE tbl (col1 VARCHAR(20), col2 VARCHAR(20));" || ret=2
143143
postgresql_cmd <<< "INSERT INTO tbl VALUES ('foo1', 'bar1');" || ret=3
144144
postgresql_cmd <<< "INSERT INTO tbl VALUES ('foo2', 'bar2');" || ret=4
@@ -631,6 +631,7 @@ $volume_options
631631

632632
assert_login_access ${user} ${password} true || ret=4
633633
assert_login_access 'postgres' ${admin_password} true || ret=5
634+
test_postgresql || ret 55
634635

635636
echo " Changing passwords"
636637

@@ -662,6 +663,9 @@ $volume_options
662663
assert_login_access 'postgres' "NEW_${admin_password}" true || ret=10
663664
assert_login_access 'postgres' ${admin_password} false || ret=11
664665

666+
# check that we still work with the original volume
667+
postgresql_cmd -At -c "SELECT * FROM tbl;" | grep bar3 || ret=12
668+
665669
if [ $ret -eq 0 ]; then
666670
echo " Success!"
667671
fi

0 commit comments

Comments
 (0)
Please sign in to comment.