mirror of
https://github.com/offen/docker-volume-backup.git
synced 2026-04-29 19:55:36 +02:00
Update existing tests and test actual pruning
This commit is contained in:
22
test/retention/docker-compose.yml
Normal file
22
test/retention/docker-compose.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
services:
|
||||
backup:
|
||||
image: offen/docker-volume-backup:${TEST_VERSION:-canary}
|
||||
restart: always
|
||||
environment:
|
||||
BACKUP_CRON_EXPRESSION: 0 0 5 31 2 ?
|
||||
BACKUP_RETENTION_PERIOD: 15s
|
||||
BACKUP_PRUNING_LEEWAY: 1s
|
||||
volumes:
|
||||
- app_data:/backup/app_data:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ${LOCAL_DIR:-./local}:/archive
|
||||
|
||||
offen:
|
||||
image: offen/offen:latest
|
||||
labels:
|
||||
- docker-volume-backup.stop-during-backup=true
|
||||
volumes:
|
||||
- app_data:/var/opt/offen
|
||||
|
||||
volumes:
|
||||
app_data:
|
||||
28
test/retention/run.sh
Executable file
28
test/retention/run.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
. ../util.sh
|
||||
current_test=$(basename $(pwd))
|
||||
|
||||
export LOCAL_DIR=$(mktemp -d)
|
||||
|
||||
docker compose up -d --quiet-pull
|
||||
sleep 5
|
||||
|
||||
docker compose exec backup backup
|
||||
|
||||
sleep 20
|
||||
|
||||
if [ $(ls -1 $LOCAL_DIR | wc -l) != "1" ]; then
|
||||
fail "Unexpected number of backups after initial run"
|
||||
fi
|
||||
pass "Found 1 backup files."
|
||||
|
||||
docker compose exec backup backup
|
||||
|
||||
if [ $(ls -1 $LOCAL_DIR | wc -l) != "1" ]; then
|
||||
fail "Unexpected number of backups after initial run"
|
||||
fi
|
||||
pass "Found 1 backup files."
|
||||
Reference in New Issue
Block a user