mirror of
https://github.com/offen/docker-volume-backup.git
synced 2026-04-20 07:42:39 +02:00
Run tests Docker in Docker (#261)
* Try running tests in Docker * Spawn new container for each test * Store test artifacts outside of mount * When requested, build up to date image in test script * sudo is unneccessary in containerized test env * Skip azure test * Backdate fixture file in JSON database * Pin versions for azure tools * Mount temp volume for /var/lib/docker to prevent dangling ones created by VOLUME instruction * Fail backdating tests with message * Add some documentation on test setup * Cache images * Run compose stacks with shortened default timeout
This commit is contained in:
1
test/confd/.gitignore
vendored
1
test/confd/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
local
|
||||
@@ -5,7 +5,7 @@ services:
|
||||
image: offen/docker-volume-backup:${TEST_VERSION:-canary}
|
||||
restart: always
|
||||
volumes:
|
||||
- ./local:/archive
|
||||
- ${LOCAL_DIR:-./local}:/archive
|
||||
- app_data:/backup/app_data:ro
|
||||
- ./01backup.env:/etc/dockervolumebackup/conf.d/01backup.env
|
||||
- ./02backup.env:/etc/dockervolumebackup/conf.d/02backup.env
|
||||
|
||||
@@ -6,26 +6,24 @@ cd $(dirname $0)
|
||||
. ../util.sh
|
||||
current_test=$(basename $(pwd))
|
||||
|
||||
mkdir -p local
|
||||
export LOCAL_DIR=$(mktemp -d)
|
||||
|
||||
docker compose up -d --quiet-pull
|
||||
|
||||
# sleep until a backup is guaranteed to have happened on the 1 minute schedule
|
||||
sleep 100
|
||||
|
||||
docker compose down --volumes
|
||||
|
||||
if [ ! -f ./local/conf.tar.gz ]; then
|
||||
if [ ! -f "$LOCAL_DIR/conf.tar.gz" ]; then
|
||||
fail "Config from file was not used."
|
||||
fi
|
||||
pass "Config from file was used."
|
||||
|
||||
if [ ! -f ./local/other.tar.gz ]; then
|
||||
if [ ! -f "$LOCAL_DIR/other.tar.gz" ]; then
|
||||
fail "Run on same schedule did not succeed."
|
||||
fi
|
||||
pass "Run on same schedule succeeded."
|
||||
|
||||
if [ -f ./local/never.tar.gz ]; then
|
||||
if [ -f "$LOCAL_DIR/never.tar.gz" ]; then
|
||||
fail "Unexpected file was found."
|
||||
fi
|
||||
pass "Unexpected cron did not run."
|
||||
|
||||
Reference in New Issue
Block a user