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
|
|
|
|
|
|
|
mkdir -p local
|
|
|
|
|
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
|
|
|
|
2022-06-23 14:40:29 +02:00
|
|
|
tmp_dir=$(mktemp -d)
|
|
|
|
sudo tar --same-owner -xvf ./local/backup.tar.gz -C $tmp_dir
|
2022-02-22 07:49:24 +01:00
|
|
|
|
2022-06-23 14:40:29 +02:00
|
|
|
sudo find $tmp_dir/backup/postgres > /dev/null
|
|
|
|
pass "Backup contains files at expected location"
|
2022-02-22 07:49:24 +01:00
|
|
|
|
2022-06-23 14:40:29 +02:00
|
|
|
for file in $(sudo find $tmp_dir/backup/postgres); do
|
2022-02-22 07:49:24 +01:00
|
|
|
if [ "$(sudo stat -c '%u:%g' $file)" != "70:70" ]; then
|
2022-06-23 14:40:29 +02:00
|
|
|
fail "Unexpected file ownership for $file: $(sudo 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."
|
2022-02-22 07:49:24 +01:00
|
|
|
|
2023-01-07 18:50:27 +01:00
|
|
|
docker compose down --volumes
|