Skip to content

Commit 527d0ed

Browse files
committed
Add empty file check
1 parent 442cbd5 commit 527d0ed

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tmt/tests/container/sanity/upgrade/upgrade.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ su - postgres -c "
2929
echo \"User switched\";
3030
3131
createdb testdb;
32-
psql -U postgres -d testdb -c \"create table users (id serial primary key, name text)\";
33-
psql -U postgres -d testdb -c \"insert into users (name) values ('Alice'), ('Bob'), ('Celine')\"
32+
psql -h /tmp -U postgres -d testdb -c \"create table users (id serial primary key, name text)\";
33+
psql -h /tmp -U postgres -d testdb -c \"insert into users (name) values ('Alice'), ('Bob'), ('Celine')\"
3434
"
3535
su - postgres -c '
3636
psql -U postgres -d testdb -c "select * from users"
@@ -39,6 +39,8 @@ psql -U postgres -d testdb -c "select * from users"
3939
echo "Expected:"
4040
cat expected.txt
4141

42+
test $(wc -l < expected.txt) -gt 0 || { echo "ERROR: expected.txt is empty!"; exit 1; }
43+
4244
# uninstall postgresql
4345
dnf -y remove postgresql-server postgresql-private-libs postgresql libicu
4446

@@ -54,10 +56,11 @@ su - postgres -c "
5456
"
5557

5658
su - postgres -c '
57-
psql -U postgres -d testdb -c "select * from users"
59+
psql -h /tmp -U postgres -d testdb -c "select * from users"
5860
' > actual.txt
5961

6062
echo "Actual:"
6163
cat actual.txt
6264

6365
diff -q expected.txt actual.txt && echo "Actual and expected outputs match" || { echo "Actual and expected outputs differ"; exit 1; }
66+

0 commit comments

Comments
 (0)