2022-02-22 07:49:24 +01:00
|
|
|
#!/bin/sh
|
|
|
|
# This test refers to https://github.com/offen/docker-volume-backup/issues/71
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd $(dirname $0)
|
2022-06-23 14:40:29 +02:00
|
|
|
. ../util.sh
|
|
|
|
current_test=$(basename $(pwd))
|
2022-02-22 07:49:24 +01:00
|
|
|
|
2023-09-02 15:17:46 +02:00
|
|
|
export LOCAL_DIR=$(mktemp -d)
|
2022-02-22 07:49:24 +01:00
|
|
|
|
2023-08-27 19:19:11 +02:00
|
|
|
docker compose up -d --quiet-pull
|
2022-02-22 07:49:24 +01:00
|
|
|
sleep 5
|
|
|
|
|
2023-01-07 18:50:27 +01:00
|
|
|
docker compose exec backup backup
|
2022-02-22 07:49:24 +01:00
|
|
|
|
2023-09-02 15:17:46 +02:00
|
|
|
TMP_DIR=$(mktemp -d)
|
|
|
|
tar --same-owner -xvf "$LOCAL_DIR/backup.tar.gz" -C $TMP_DIR
|
2022-02-22 07:49:24 +01:00
|
|
|
|
2023-09-02 15:17:46 +02:00
|
|
|
find $TMP_DIR/backup/postgres > /dev/null
|
2022-06-23 14:40:29 +02:00
|
|
|
pass "Backup contains files at expected location"
|
2022-02-22 07:49:24 +01:00
|
|
|
|
2023-09-02 15:17:46 +02:00
|
|
|
for file in $(find $TMP_DIR/backup/postgres); do
|
|
|
|
if [ "$(stat -c '%u:%g' $file)" != "70:70" ]; then
|
|
|
|
fail "Unexpected file ownership for $file: $(stat -c '%u:%g' $file)"
|
2022-02-22 07:49:24 +01:00
|
|
|
fi
|
|
|
|
done
|
2022-06-23 14:40:29 +02:00
|
|
|
pass "All files and directories in backup preserved their ownership."
|