You've already forked docker-volume-backup
mirror of
https://github.com/offen/docker-volume-backup.git
synced 2025-11-29 05:46:50 +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:
@@ -9,7 +9,7 @@ current_test=$(basename $(pwd))
|
||||
docker network create test_network
|
||||
docker volume create app_data
|
||||
|
||||
mkdir -p local
|
||||
LOCAL_DIR=$(mktemp -d)
|
||||
|
||||
docker run -d -q \
|
||||
--name offen \
|
||||
@@ -22,7 +22,7 @@ sleep 10
|
||||
docker run --rm -q \
|
||||
--network test_network \
|
||||
-v app_data:/backup/app_data \
|
||||
-v ./local:/archive \
|
||||
-v $LOCAL_DIR:/archive \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
--env BACKUP_COMPRESSION=zst \
|
||||
--env BACKUP_FILENAME='test.{{ .Extension }}' \
|
||||
@@ -30,7 +30,7 @@ docker run --rm -q \
|
||||
offen/docker-volume-backup:${TEST_VERSION:-canary}
|
||||
|
||||
tmp_dir=$(mktemp -d)
|
||||
tar -xvf ./local/test.tar.zst --zstd -C $tmp_dir
|
||||
tar -xvf "$LOCAL_DIR/test.tar.zst" --zstd -C $tmp_dir
|
||||
if [ ! -f "$tmp_dir/backup/app_data/offen.db" ]; then
|
||||
fail "Could not find expected file in untared archive."
|
||||
fi
|
||||
@@ -39,8 +39,3 @@ pass "Found relevant files in untared local backup."
|
||||
# This test does not stop containers during backup. This is happening on
|
||||
# purpose in order to cover this setup as well.
|
||||
expect_running_containers "1"
|
||||
|
||||
docker rm $(docker stop offen)
|
||||
|
||||
docker volume rm app_data
|
||||
docker network rm test_network
|
||||
|
||||
Reference in New Issue
Block a user