mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-23 05:30:33 +01:00
Frederik Ring
3ded77448c
* Update targz library to include potential ownership fix * Move archive logic to main repo * Remove assertions for debugging * Use relative path in assertion * Strip local part from archive location * Log when extracting in tests * Fix trimming of prfix * Add license info to archive.go file * Undo change in test assertion * Add test checking for preserved file ownership * use same postgres version in tests * Wrap errors when archiving, handle deletion at script layer
29 lines
692 B
Bash
29 lines
692 B
Bash
#!/bin/sh
|
|
# This test refers to https://github.com/offen/docker-volume-backup/issues/71
|
|
|
|
set -e
|
|
|
|
cd $(dirname $0)
|
|
|
|
mkdir -p local
|
|
|
|
docker-compose up -d
|
|
sleep 5
|
|
|
|
docker-compose exec backup backup
|
|
|
|
sudo tar --same-owner -xvf ./local/backup.tar.gz -C /tmp
|
|
|
|
sudo find /tmp/backup/postgres > /dev/null
|
|
echo "[TEST:PASS] Backup contains files at expected location"
|
|
|
|
for file in $(sudo find /tmp/backup/postgres); do
|
|
if [ "$(sudo stat -c '%u:%g' $file)" != "70:70" ]; then
|
|
echo "[TEST:FAIL] Unexpected file ownership for $file: $(sudo stat -c '%u:%g' $file)"
|
|
exit 1
|
|
fi
|
|
done
|
|
echo "[TEST:PASS] All files and directories in backup preserved their ownership."
|
|
|
|
docker-compose down --volumes
|