mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-22 05:10:28 +01:00
Run tests using compose v2 (#178)
This commit is contained in:
parent
1cb4883458
commit
9b7af67a26
@ -24,10 +24,10 @@ openssl x509 -req -passin pass:test \
|
||||
|
||||
openssl x509 -in minio.crt -noout -text
|
||||
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
sleep 5
|
||||
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
|
||||
sleep 5
|
||||
|
||||
@ -40,4 +40,4 @@ docker run --rm -it \
|
||||
|
||||
pass "Found relevant files in untared remote backups."
|
||||
|
||||
docker-compose down --volumes
|
||||
docker compose down --volumes
|
||||
|
@ -6,10 +6,10 @@ cd $(dirname $0)
|
||||
. ../util.sh
|
||||
current_test=$(basename $(pwd))
|
||||
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
sleep 30 # mariadb likes to take a bit before responding
|
||||
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
sudo cp -r $(docker volume inspect --format='{{ .Mountpoint }}' commands_archive) ./local
|
||||
|
||||
tar -xvf ./local/test.tar.gz
|
||||
@ -28,7 +28,7 @@ if [ -f ./backup/data/post.txt ]; then
|
||||
fi
|
||||
pass "Did not find unexpected file."
|
||||
|
||||
docker-compose down --volumes
|
||||
docker compose down --volumes
|
||||
sudo rm -rf ./local
|
||||
|
||||
|
||||
|
@ -8,12 +8,12 @@ current_test=$(basename $(pwd))
|
||||
|
||||
mkdir -p local
|
||||
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
|
||||
# sleep until a backup is guaranteed to have happened on the 1 minute schedule
|
||||
sleep 100
|
||||
|
||||
docker-compose down --volumes
|
||||
docker compose down --volumes
|
||||
|
||||
if [ ! -f ./local/conf.tar.gz ]; then
|
||||
fail "Config from file was not used."
|
||||
|
@ -12,10 +12,10 @@ export TEST_VERSION="${TEST_VERSION:-canary}-with-rsync"
|
||||
|
||||
docker build . -t offen/docker-volume-backup:$TEST_VERSION
|
||||
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
sleep 5
|
||||
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
|
||||
sleep 5
|
||||
|
||||
@ -25,4 +25,4 @@ if [ ! -f "./local/app_data/offen.db" ]; then
|
||||
fail "Could not find expected file in untared archive."
|
||||
fi
|
||||
|
||||
docker-compose down --volumes
|
||||
docker compose down --volumes
|
||||
|
@ -8,10 +8,10 @@ current_test=$(basename $(pwd))
|
||||
|
||||
mkdir -p local
|
||||
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
sleep 5
|
||||
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
|
||||
expect_running_containers "2"
|
||||
|
||||
@ -30,4 +30,4 @@ if [ ! -L ./local/test-latest.tar.gz.gpg ]; then
|
||||
fail "Could not find local symlink to latest encrypted backup."
|
||||
fi
|
||||
|
||||
docker-compose down --volumes
|
||||
docker compose down --volumes
|
||||
|
@ -8,11 +8,11 @@ current_test=$(basename $(pwd))
|
||||
|
||||
mkdir -p local
|
||||
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
sleep 5
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
|
||||
docker-compose down --volumes
|
||||
docker compose down --volumes
|
||||
|
||||
out=$(mktemp -d)
|
||||
sudo tar --same-owner -xvf ./local/test.tar.gz -C "$out"
|
||||
|
@ -8,13 +8,13 @@ current_test=$(basename $(pwd))
|
||||
|
||||
mkdir -p local
|
||||
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
sleep 5
|
||||
|
||||
# A symlink for a known file in the volume is created so the test can check
|
||||
# whether symlinks are preserved on backup.
|
||||
docker-compose exec offen ln -s /var/opt/offen/offen.db /var/opt/offen/db.link
|
||||
docker-compose exec backup backup
|
||||
docker compose exec offen ln -s /var/opt/offen/offen.db /var/opt/offen/db.link
|
||||
docker compose exec backup backup
|
||||
|
||||
sleep 5
|
||||
|
||||
@ -42,14 +42,14 @@ pass "Found symlink to latest version in local backup."
|
||||
# The second part of this test checks if backups get deleted when the retention
|
||||
# is set to 0 days (which it should not as it would mean all backups get deleted)
|
||||
# TODO: find out if we can test actual deletion without having to wait for a day
|
||||
BACKUP_RETENTION_DAYS="0" docker-compose up -d
|
||||
BACKUP_RETENTION_DAYS="0" docker compose up -d
|
||||
sleep 5
|
||||
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
|
||||
if [ "$(find ./local -type f | wc -l)" != "1" ]; then
|
||||
fail "Backups should not have been deleted, instead seen: "$(find ./local -type f)""
|
||||
fi
|
||||
pass "Local backups have not been deleted."
|
||||
|
||||
docker-compose down --volumes
|
||||
docker compose down --volumes
|
||||
|
@ -8,13 +8,13 @@ current_test=$(basename $(pwd))
|
||||
|
||||
mkdir -p local
|
||||
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
sleep 5
|
||||
|
||||
GOTIFY_TOKEN=$(curl -sSLX POST -H 'Content-Type: application/json' -d '{"name":"test"}' http://admin:custom@localhost:8080/application | jq -r '.token')
|
||||
info "Set up Gotify application using token $GOTIFY_TOKEN"
|
||||
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
|
||||
NUM_MESSAGES=$(curl -sSL http://admin:custom@localhost:8080/message | jq -r '.messages | length')
|
||||
if [ "$NUM_MESSAGES" != 0 ]; then
|
||||
@ -22,11 +22,11 @@ if [ "$NUM_MESSAGES" != 0 ]; then
|
||||
fi
|
||||
pass "No notifications were sent when not configured."
|
||||
|
||||
docker-compose down
|
||||
docker compose down
|
||||
|
||||
NOTIFICATION_URLS="gotify://gotify/${GOTIFY_TOKEN}?disableTLS=true" docker-compose up -d
|
||||
NOTIFICATION_URLS="gotify://gotify/${GOTIFY_TOKEN}?disableTLS=true" docker compose up -d
|
||||
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
|
||||
NUM_MESSAGES=$(curl -sSL http://admin:custom@localhost:8080/message | jq -r '.messages | length')
|
||||
if [ "$NUM_MESSAGES" != 1 ]; then
|
||||
@ -47,4 +47,4 @@ if [ "$MESSAGE_BODY" != "Backing up /tmp/test.tar.gz succeeded." ]; then
|
||||
fi
|
||||
pass "Custom notification body was used."
|
||||
|
||||
docker-compose down --volumes
|
||||
docker compose down --volumes
|
||||
|
@ -9,10 +9,10 @@ current_test=$(basename $(pwd))
|
||||
|
||||
mkdir -p local
|
||||
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
sleep 5
|
||||
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
|
||||
tmp_dir=$(mktemp -d)
|
||||
sudo tar --same-owner -xvf ./local/backup.tar.gz -C $tmp_dir
|
||||
@ -27,4 +27,4 @@ for file in $(sudo find $tmp_dir/backup/postgres); do
|
||||
done
|
||||
pass "All files and directories in backup preserved their ownership."
|
||||
|
||||
docker-compose down --volumes
|
||||
docker compose down --volumes
|
||||
|
@ -6,12 +6,12 @@ cd "$(dirname "$0")"
|
||||
. ../util.sh
|
||||
current_test=$(basename $(pwd))
|
||||
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
sleep 5
|
||||
|
||||
# A symlink for a known file in the volume is created so the test can check
|
||||
# whether symlinks are preserved on backup.
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
|
||||
sleep 5
|
||||
|
||||
@ -27,10 +27,10 @@ pass "Found relevant files in untared remote backups."
|
||||
# The second part of this test checks if backups get deleted when the retention
|
||||
# is set to 0 days (which it should not as it would mean all backups get deleted)
|
||||
# TODO: find out if we can test actual deletion without having to wait for a day
|
||||
BACKUP_RETENTION_DAYS="0" docker-compose up -d
|
||||
BACKUP_RETENTION_DAYS="0" docker compose up -d
|
||||
sleep 5
|
||||
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
|
||||
docker run --rm -it \
|
||||
-v minio_backup_data:/minio_data \
|
||||
@ -39,4 +39,4 @@ docker run --rm -it \
|
||||
|
||||
pass "Remote backups have not been deleted."
|
||||
|
||||
docker-compose down --volumes
|
||||
docker compose down --volumes
|
||||
|
@ -8,10 +8,10 @@ current_test=$(basename $(pwd))
|
||||
|
||||
ssh-keygen -t rsa -m pem -b 4096 -N "test1234" -f id_rsa -C "docker-volume-backup@local"
|
||||
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
sleep 5
|
||||
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
|
||||
sleep 5
|
||||
|
||||
@ -27,10 +27,10 @@ pass "Found relevant files in decrypted and untared remote backups."
|
||||
# The second part of this test checks if backups get deleted when the retention
|
||||
# is set to 0 days (which it should not as it would mean all backups get deleted)
|
||||
# TODO: find out if we can test actual deletion without having to wait for a day
|
||||
BACKUP_RETENTION_DAYS="0" docker-compose up -d
|
||||
BACKUP_RETENTION_DAYS="0" docker compose up -d
|
||||
sleep 5
|
||||
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
|
||||
docker run --rm -it \
|
||||
-v ssh_backup_data:/ssh_data \
|
||||
@ -39,5 +39,5 @@ docker run --rm -it \
|
||||
|
||||
pass "Remote backups have not been deleted."
|
||||
|
||||
docker-compose down --volumes
|
||||
docker compose down --volumes
|
||||
rm -f id_rsa id_rsa.pub
|
||||
|
@ -6,10 +6,10 @@ cd "$(dirname "$0")"
|
||||
. ../util.sh
|
||||
current_test=$(basename $(pwd))
|
||||
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
sleep 5
|
||||
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
|
||||
sleep 5
|
||||
|
||||
@ -25,10 +25,10 @@ pass "Found relevant files in untared remote backup."
|
||||
# The second part of this test checks if backups get deleted when the retention
|
||||
# is set to 0 days (which it should not as it would mean all backups get deleted)
|
||||
# TODO: find out if we can test actual deletion without having to wait for a day
|
||||
BACKUP_RETENTION_DAYS="0" docker-compose up -d
|
||||
BACKUP_RETENTION_DAYS="0" docker compose up -d
|
||||
sleep 5
|
||||
|
||||
docker-compose exec backup backup
|
||||
docker compose exec backup backup
|
||||
|
||||
docker run --rm -it \
|
||||
-v webdav_backup_data:/webdav_data \
|
||||
@ -37,4 +37,4 @@ docker run --rm -it \
|
||||
|
||||
pass "Remote backups have not been deleted."
|
||||
|
||||
docker-compose down --volumes
|
||||
docker compose down --volumes
|
||||
|
Loading…
Reference in New Issue
Block a user