mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-14 02:25:49 +01:00
Frederik Ring
c2a8cc92fc
* Isolate S3 test case * Isolate webdav test case * Isolate SSH test case * Isolate local storage test case * Isolate gpg test case * Add missing volume mount * Fix file locations for local test case * Remove compose test case, use utils * Use test utils throughout * Use dedicated tmp dir * Fix link location that is being tested * Use dedicated tmp_dirs when working on host fs * Force delete artifact * Fix expected filename * Provide helpful messages on failing tests * Fix filename * Use proper volume names * Fix syntax error, use large resource class * Use named Docker volumes when referencing them in test scripts * Add name of test case to logging output
64 lines
1.7 KiB
Bash
Executable File
64 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
cd $(dirname $0)
|
|
. ../util.sh
|
|
current_test=$(basename $(pwd))
|
|
|
|
docker network create test_network
|
|
docker volume create backup_data
|
|
docker volume create app_data
|
|
# This volume is created to test whether empty directories are handled
|
|
# correctly. It is not supposed to hold any data.
|
|
docker volume create empty_data
|
|
|
|
docker run -d \
|
|
--name minio \
|
|
--network test_network \
|
|
--env MINIO_ROOT_USER=test \
|
|
--env MINIO_ROOT_PASSWORD=test \
|
|
--env MINIO_ACCESS_KEY=test \
|
|
--env MINIO_SECRET_KEY=GMusLtUmILge2by+z890kQ \
|
|
-v backup_data:/data \
|
|
minio/minio:RELEASE.2020-08-04T23-10-51Z server /data
|
|
|
|
docker exec minio mkdir -p /data/backup
|
|
|
|
docker run -d \
|
|
--name offen \
|
|
--network test_network \
|
|
-v app_data:/var/opt/offen/ \
|
|
offen/offen:latest
|
|
|
|
sleep 10
|
|
|
|
docker run --rm \
|
|
--network test_network \
|
|
-v app_data:/backup/app_data \
|
|
-v empty_data:/backup/empty_data \
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
--env AWS_ACCESS_KEY_ID=test \
|
|
--env AWS_SECRET_ACCESS_KEY=GMusLtUmILge2by+z890kQ \
|
|
--env AWS_ENDPOINT=minio:9000 \
|
|
--env AWS_ENDPOINT_PROTO=http \
|
|
--env AWS_S3_BUCKET_NAME=backup \
|
|
--env BACKUP_FILENAME=test.tar.gz \
|
|
--env "BACKUP_FROM_SNAPSHOT=true" \
|
|
--entrypoint backup \
|
|
offen/docker-volume-backup:${TEST_VERSION:-canary}
|
|
|
|
docker run --rm -it \
|
|
-v backup_data:/data alpine \
|
|
ash -c 'tar -xvf /data/backup/test.tar.gz && test -f /backup/app_data/offen.db && test -d /backup/empty_data'
|
|
|
|
pass "Found relevant files in untared remote 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 "2"
|
|
|
|
docker rm $(docker stop minio offen)
|
|
docker volume rm backup_data app_data
|
|
docker network rm test_network
|