Skip to content

Commit 1d41180

Browse files
committed
Edit socket directory
1 parent e12715d commit 1d41180

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

tmt/tests/container/sanity/init/init.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@ make
1616
# initialization
1717
./bin/postgresql-setup --init
1818

19+
# create socket directory
20+
mkdir -p /var/run/postgresql
21+
chown postgres:postgres /var/run/postgresql
22+
chmod 2775 /var/run/postgresql
23+
1924
# start postgresql and check if it's running
2025
PGDATA=/var/lib/pgsql/data
2126
LOGFILE=/var/lib/pgsql/logfile
2227
su - postgres -c "
23-
/usr/bin/pg_ctl -D $PGDATA -l $LOGFILE -o \"-c unix_socket_directories=/tmp\" start
28+
/usr/bin/pg_ctl -D $PGDATA -l $LOGFILE start
2429
/usr/bin/pg_ctl -D $PGDATA status && echo \"PostgreSQL is running\" || { echo \"PostgreSQL is NOT running\"; exit 1; }
2530
"
2631

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,29 @@ make
1616
# initialization
1717
./bin/postgresql-setup --init
1818

19+
# Create unix_socket directory
20+
mkdir -p /var/run/postgresql
21+
chown postgres:postgres /var/run/postgresql
22+
chmod 2775 /var/run/postgresql
23+
1924
# start postgresql and check if it's running
2025
PGDATA=/var/lib/pgsql/data
2126
LOGFILE=/var/lib/pgsql/logfile
2227
su - postgres -c "
23-
/usr/bin/pg_ctl -D $PGDATA -l $LOGFILE -o \"-c unix_socket_directories=/tmp\" start
28+
/usr/bin/pg_ctl -D $PGDATA -l $LOGFILE start
2429
/usr/bin/pg_ctl -D $PGDATA status && echo \"PostgreSQL is running\" || { echo \"PostgreSQL is NOT running\"; exit 1; }
2530
"
2631

2732
# insert data
2833
su - postgres -c "
2934
echo \"User switched\";
3035
31-
createdb -h /tmp testdb;
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')\"
36+
createdb testdb;
37+
psql -U postgres -d testdb -c \"create table users (id serial primary key, name text)\";
38+
psql -U postgres -d testdb -c \"insert into users (name) values ('Alice'), ('Bob'), ('Celine')\"
3439
"
3540
su - postgres -c '
36-
psql -h /tmp -U postgres -d testdb -c "select * from users"
41+
psql -U postgres -d testdb -c "select * from users"
3742
' > expected.txt
3843

3944
echo "Expected:"
@@ -51,12 +56,12 @@ dnf -y install postgresql17-upgrade
5156
./bin/postgresql-setup --upgrade
5257

5358
su - postgres -c "
54-
/usr/bin/pg_ctl -D $PGDATA -l $LOGFILE -o \"-c unix_socket_directories=/tmp\" start
59+
/usr/bin/pg_ctl -D $PGDATA -l $LOGFILE -o start
5560
/usr/bin/pg_ctl -D $PGDATA status && echo \"PostgreSQL is running\" || { echo \"PostgreSQL is NOT running\"; exit 1; }
5661
"
5762

5863
su - postgres -c '
59-
psql -h /tmp -U postgres -d testdb -c "select * from users"
64+
psql -U postgres -d testdb -c "select * from users"
6065
' > actual.txt
6166

6267
echo "Actual:"

0 commit comments

Comments
 (0)