mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-22 21:30:28 +01:00
Add test case for exec label (#132)
This commit is contained in:
parent
3f10d0f817
commit
26c8ba971f
@ -1115,7 +1115,7 @@ services:
|
|||||||
labels:
|
labels:
|
||||||
- docker-volume-backup.archive-pre=/bin/sh -c 'mysqldump -psecret --all-databases > /tmp/dumps/dump.sql'
|
- docker-volume-backup.archive-pre=/bin/sh -c 'mysqldump -psecret --all-databases > /tmp/dumps/dump.sql'
|
||||||
volumes:
|
volumes:
|
||||||
- app_data:/tmp/dumps
|
- data:/tmp/dumps
|
||||||
backup:
|
backup:
|
||||||
image: offen/docker-volume-backup:v2
|
image: offen/docker-volume-backup:v2
|
||||||
environment:
|
environment:
|
||||||
|
@ -17,6 +17,20 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- app_data:/tmp/volume
|
- 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:
|
backup:
|
||||||
image: offen/docker-volume-backup:${TEST_VERSION:-canary}
|
image: offen/docker-volume-backup:${TEST_VERSION:-canary}
|
||||||
deploy:
|
deploy:
|
||||||
|
@ -18,6 +18,11 @@ if [ ! -f ./backup/data/dump.sql ]; then
|
|||||||
fi
|
fi
|
||||||
pass "Found expected file."
|
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
|
if [ -f ./backup/data/post.txt ]; then
|
||||||
fail "File created in post command was present in backup."
|
fail "File created in post command was present in backup."
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user