mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-22 13:20:29 +01:00
Add test case for exec label (#132)
This commit is contained in:
parent
3f10d0f817
commit
26c8ba971f
@ -1115,7 +1115,7 @@ services:
|
||||
labels:
|
||||
- docker-volume-backup.archive-pre=/bin/sh -c 'mysqldump -psecret --all-databases > /tmp/dumps/dump.sql'
|
||||
volumes:
|
||||
- app_data:/tmp/dumps
|
||||
- data:/tmp/dumps
|
||||
backup:
|
||||
image: offen/docker-volume-backup:v2
|
||||
environment:
|
||||
|
@ -17,6 +17,20 @@ services:
|
||||
volumes:
|
||||
- app_data:/tmp/volume
|
||||
|
||||
other_database:
|
||||
image: mariadb:10.7
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: test
|
||||
MARIADB_DATABASE: backup
|
||||
labels:
|
||||
- docker-volume-backup.archive-pre=touch /tmp/volume/not-relevant.txt
|
||||
- docker-volume-backup.exec-label=not-relevant
|
||||
volumes:
|
||||
- app_data:/tmp/volume
|
||||
|
||||
backup:
|
||||
image: offen/docker-volume-backup:${TEST_VERSION:-canary}
|
||||
deploy:
|
||||
|
@ -18,6 +18,11 @@ if [ ! -f ./backup/data/dump.sql ]; then
|
||||
fi
|
||||
pass "Found expected file."
|
||||
|
||||
if [ -f ./backup/data/not-relevant.txt ]; then
|
||||
fail "Command ran for container with other label."
|
||||
fi
|
||||
pass "Command did not run for container with other label."
|
||||
|
||||
if [ -f ./backup/data/post.txt ]; then
|
||||
fail "File created in post command was present in backup."
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user