docker-duplicity-cron/itest.sh
2018-03-09 17:29:41 -08:00

48 lines
907 B
Bash
Executable File

#! /bin/bash
set -e
echo "Performing backup tests"
echo "Verify cron and crontab exist"
type cron
type crontab
echo "Create test data..."
mkdir -p /data && echo Test > /data/test.txt
echo "Making backup..."
/backup.sh
echo "Verify backup..."
/verify.sh
echo "Delete test data..."
rm -fr /data/*
echo "Verify deleted..."
test -f /data/test.txt && exit 1 || echo "Gone"
echo "Restore backup..."
/restore.sh
echo "Verify backup..."
/verify.sh
echo "Delete test data again..."
rm -fr /data/*
echo "Verify deleted..."
test -f /data/test.txt && exit 1 || echo "Gone"
echo "Simulate a restart with RESTORE_ON_EMPTY_START..."
RESTORE_ON_EMPTY_START=true /entrypoint.sh
echo "Verify restore happened..."
test -f /data/test.txt
echo "Verify restore with incorrect passphrase fails..."
export PASSPHRASE=Incorrect.Mule.Solar.Paperclip
echo "Fail to restore backup..."
/restore.sh && exit 1 || echo "OK"