2023-08-24 22:14:04 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd $(dirname $0)
|
|
|
|
. ../util.sh
|
|
|
|
current_test=$(basename $(pwd))
|
|
|
|
|
|
|
|
docker network create test_network
|
|
|
|
docker volume create app_data
|
|
|
|
|
2023-09-02 15:17:46 +02:00
|
|
|
LOCAL_DIR=$(mktemp -d)
|
2023-08-24 22:14:04 +02:00
|
|
|
|
2023-08-27 19:19:11 +02:00
|
|
|
docker run -d -q \
|
2023-08-24 22:14:04 +02:00
|
|
|
--name offen \
|
|
|
|
--network test_network \
|
|
|
|
-v app_data:/var/opt/offen/ \
|
|
|
|
offen/offen:latest
|
|
|
|
|
|
|
|
sleep 10
|
|
|
|
|
2023-08-27 19:19:11 +02:00
|
|
|
docker run --rm -q \
|
2023-08-24 22:14:04 +02:00
|
|
|
--network test_network \
|
|
|
|
-v app_data:/backup/app_data \
|
2023-09-02 15:17:46 +02:00
|
|
|
-v $LOCAL_DIR:/archive \
|
2023-08-24 22:14:04 +02:00
|
|
|
-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)
|
2023-09-02 15:17:46 +02:00
|
|
|
tar -xvf "$LOCAL_DIR/test.tar.zst" --zstd -C $tmp_dir
|
2023-08-24 22:14:04 +02:00
|
|
|
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"
|