2021-07-11 09:43:16 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd $(dirname $0)
|
2022-06-23 14:40:29 +02:00
|
|
|
. ../util.sh
|
|
|
|
current_test=$(basename $(pwd))
|
2021-07-11 09:43:16 +02:00
|
|
|
|
|
|
|
docker swarm init
|
|
|
|
|
|
|
|
docker stack deploy --compose-file=docker-compose.yml test_stack
|
|
|
|
|
|
|
|
while [ -z $(docker ps -q -f name=backup) ]; do
|
2022-06-23 14:40:29 +02:00
|
|
|
info "Backup container not ready yet. Retrying."
|
2021-07-11 09:43:16 +02:00
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
2021-07-11 10:39:39 +02:00
|
|
|
sleep 20
|
2021-07-11 09:43:16 +02:00
|
|
|
|
|
|
|
docker exec $(docker ps -q -f name=backup) backup
|
|
|
|
|
|
|
|
docker run --rm -it \
|
2022-06-23 14:40:29 +02:00
|
|
|
-v backup_data:/data alpine \
|
2021-07-11 10:30:16 +02:00
|
|
|
ash -c 'tar -xf /data/backup/test.tar.gz && test -f /backup/pg_data/PG_VERSION'
|
2021-07-11 09:43:16 +02:00
|
|
|
|
2022-06-23 14:40:29 +02:00
|
|
|
pass "Found relevant files in untared backup."
|
2021-07-11 09:43:16 +02:00
|
|
|
|
2022-02-11 20:05:16 +01:00
|
|
|
sleep 5
|
2022-06-23 14:40:29 +02:00
|
|
|
expect_running_containers "5"
|
2021-07-11 09:43:16 +02:00
|
|
|
|
|
|
|
docker stack rm test_stack
|
|
|
|
docker swarm leave --force
|