2023-04-02 11:12:10 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd $(dirname $0)
|
|
|
|
. ../util.sh
|
|
|
|
current_test=$(basename $(pwd))
|
|
|
|
|
2023-09-02 15:17:46 +02:00
|
|
|
export LOCAL_DIR=$(mktemp -d)
|
|
|
|
export TMP_DIR=$(mktemp -d)
|
|
|
|
|
|
|
|
echo "LOCAL_DIR $LOCAL_DIR"
|
|
|
|
echo "TMP_DIR $TMP_DIR"
|
2023-04-02 11:12:10 +02:00
|
|
|
|
2023-09-02 15:17:46 +02:00
|
|
|
docker compose up -d --quiet-pull
|
2023-04-02 11:12:10 +02:00
|
|
|
user_name=testuser
|
|
|
|
docker exec user-alpine-1 adduser --disabled-password "$user_name"
|
|
|
|
|
|
|
|
docker compose exec backup backup
|
|
|
|
|
2023-09-02 15:17:46 +02:00
|
|
|
tar -xvf "$LOCAL_DIR/test.tar.gz" -C "$TMP_DIR"
|
|
|
|
if [ ! -f "$TMP_DIR/backup/data/whoami.txt" ]; then
|
2023-04-02 11:12:10 +02:00
|
|
|
fail "Could not find file written by pre command."
|
|
|
|
fi
|
|
|
|
pass "Found expected file."
|
|
|
|
|
2023-09-02 15:17:46 +02:00
|
|
|
if [ "$(cat $TMP_DIR/backup/data/whoami.txt)" != "$user_name" ]; then
|
2023-04-02 11:12:10 +02:00
|
|
|
fail "Could not find expected user name."
|
|
|
|
fi
|
|
|
|
pass "Found expected user."
|