fix test and dry some functions

pull/403/head
Admire Nyakudya 2023-01-02 18:57:06 +02:00
rodzic b53dc9bcae
commit 831d639396
3 zmienionych plików z 14 dodań i 23 usunięć

Wyświetl plik

@ -19,7 +19,7 @@ if [[ -n "${PRINT_TEST_LOGS}" ]]; then
${VERSION} logs -f &
fi
sleep 60
sleep 30
services=("pg-default" "pg-new" "pg-recreate")
@ -48,7 +48,7 @@ if [[ -n "${PRINT_TEST_LOGS}" ]]; then
${VERSION} -f docker-compose-gs.yml logs -f &
fi
sleep 60
sleep 30
services=("pg-default" "pg-new" "pg-recreate")
@ -65,6 +65,6 @@ for service in "${services[@]}"; do
done
# special meta test to check the setup
#bash ./test_custom_waldir_gs.sh
bash ./test_custom_waldir_gs.sh
${VERSION} -f docker-compose-gs.yml down -v

Wyświetl plik

@ -58,7 +58,7 @@ while true; do
sleep 5
done;
${VERSION} down
${VERSION} -f docker-compose-gs.yml down
# Check that the correct custom initdb waldir works, twice after container restart.
echo "### Checking custom POSTGRES_INITDB_WALDIR should work"

Wyświetl plik

@ -538,25 +538,16 @@ function directory_checker() {
function non_root_permission() {
USER="$1"
GROUP="$2"
if [ -z "${POSTGRES_INITDB_WALDIR}" ];then
echo -e "[Entrypoint] \e[1;31m PG Wal Dir is not set, skipping changing permissions \033[0m"
else
directory_checker "${POSTGRES_INITDB_WALDIR}"
fi
#TODO Dry the function below
directory_checker "${DATADIR}"
directory_checker "/usr/lib/postgresql/"
directory_checker "/etc/"
directory_checker "${WAL_ARCHIVE}"
directory_checker "${SCRIPTS_LOCKFILE_DIR}"
directory_checker "${CONF_LOCKFILE_DIR}"
directory_checker "${EXTRA_CONF_DIR}"
directory_checker "${SSL_DIR}"
directory_checker "/var/run/"
directory_checker "/var/lib/"
directory_checker "/usr/bin"
directory_checker "/tmp"
directory_checker "/scripts"
path_envs=("${DATADIR}" "${WAL_ARCHIVE}" "${SCRIPTS_LOCKFILE_DIR}" "${CONF_LOCKFILE_DIR}" "${EXTRA_CONF_DIR}" "${SSL_DIR}" "${POSTGRES_INITDB_WALDIR}")
for dir_names in "${path_envs[@]}";do
if [ ! -z "${dir_names}" ];then
directory_checker "${dir_names}"
fi
done
services=("/usr/lib/postgresql/" "/etc/" "/var/run/" "/var/lib/" "/usr/bin" "/tmp" "/scripts")
for paths in "${services[@]}"; do
directory_checker $paths
done
chmod -R 750 ${DATADIR} ${WAL_ARCHIVE}
}