Skip to content

Commit

Permalink
daemon test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Galkin committed Oct 21, 2022
1 parent 6ffc97c commit 66c110d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
4 changes: 1 addition & 3 deletions docker/pg_tests/scripts/configs/daemon_test_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
"WALG_USE_WAL_DELTA": "true",
"WALG_UPLOAD_CONCURRENCY": "1",
"WALG_UPLOAD_QUEUE": "1",
"WALG_UPLOAD_DISK_CONCURRENCY": "1"
"PGDATABASE": "postgres",
"PGHOST": "/var/run/postgresql",
"WALG_UPLOAD_DISK_CONCURRENCY": "1"
20 changes: 17 additions & 3 deletions docker/pg_tests/scripts/tests/daemon_test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
set -e -x

PGDATA="/var/lib/postgresql/10/main"

CONFIG_FILE="/tmp/configs/daemon_test_config.json"

COMMON_CONFIG="/tmp/configs/common_config.json"
Expand All @@ -11,9 +13,23 @@ echo "," >> ${TMP_CONFIG}
cat ${COMMON_CONFIG} >> ${TMP_CONFIG}
/tmp/scripts/wrap_config_file.sh ${TMP_CONFIG}

/usr/lib/postgresql/10/bin/initdb ${PGDATA}
{
echo "wal_level = replica"
echo "archive_mode = on"
} >> ${PGDATA}/postgresql.conf

/usr/lib/postgresql/10/bin/pg_ctl -D ${PGDATA} -w start --help
/tmp/scripts/wait_while_pg_not_ready.sh

wal-g --config=${TMP_CONFIG} delete everything FORCE --confirm

pgbench -i -s 50 postgres
du -hs ${PGDATA}
sleep 1
WAL=$(ls -l ${PGDATA}/pg_wal | head -n2 | tail -n1 | egrep -o "[0-9A-F]{24}")
SOCKET="/tmp/wal-daemon.sock"

SOCKET="/tmp/wal-daemon.sock"
wal-g --config=${TMP_CONFIG} daemon ${SOCKET}

if (echo -en "C\x0\x8"; echo -n "CHECK"; echo -en "F\x0\x1B"; echo -n "${WAL}") | nc -U ${SOCKET} | grep -q "OO"; then
Expand All @@ -22,5 +38,3 @@ else
echo "Error in WAL-G response"
exit 1
fi

wal-g st ls ${WALE_S3_PREFIX}/wal_005/${WAL}.br

0 comments on commit 66c110d

Please sign in to comment.