mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-22 05:10:28 +01:00
Zstd test does not need to spin up MinIO server (#258)
This commit is contained in:
parent
7011261dc5
commit
88a4794083
@ -1,66 +0,0 @@
|
|||||||
#!/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_COMPRESSION=zst \
|
|
||||||
--env BACKUP_FILENAME='test.{{ .Extension }}' \
|
|
||||||
--env "BACKUP_FROM_SNAPSHOT=true" \
|
|
||||||
--entrypoint backup \
|
|
||||||
offen/docker-volume-backup:${TEST_VERSION:-canary}
|
|
||||||
|
|
||||||
# Have to install tar and zstd on Alpine because the plain image comes with very
|
|
||||||
# basic tar from busybox and it does not seem to support zstd
|
|
||||||
docker run --rm \
|
|
||||||
-v backup_data:/data alpine \
|
|
||||||
ash -c 'apk add --no-cache zstd tar && tar -xvf /data/backup/test.tar.zst --zstd && 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
|
|
46
test/zstd/run.sh
Executable file
46
test/zstd/run.sh
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd $(dirname $0)
|
||||||
|
. ../util.sh
|
||||||
|
current_test=$(basename $(pwd))
|
||||||
|
|
||||||
|
docker network create test_network
|
||||||
|
docker volume create app_data
|
||||||
|
|
||||||
|
mkdir -p local
|
||||||
|
|
||||||
|
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 ./local:/archive \
|
||||||
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
|
--env BACKUP_COMPRESSION=zst \
|
||||||
|
--env BACKUP_FILENAME='test.{{ .Extension }}' \
|
||||||
|
--entrypoint backup \
|
||||||
|
offen/docker-volume-backup:${TEST_VERSION:-canary}
|
||||||
|
|
||||||
|
tmp_dir=$(mktemp -d)
|
||||||
|
tar -xvf ./local/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
|
||||||
|
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
|
Loading…
Reference in New Issue
Block a user