2017-11-15 19:02:12 +00:00
|
|
|
#! /bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
echo "Performing backup tests"
|
|
|
|
|
2018-01-29 20:29:33 +00:00
|
|
|
echo "Verify cron and crontab exist"
|
|
|
|
type cron
|
|
|
|
type crontab
|
|
|
|
|
2017-11-15 19:02:12 +00:00
|
|
|
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/*
|
|
|
|
|
2018-03-10 01:29:41 +00:00
|
|
|
echo "Verify deleted..."
|
|
|
|
test -f /data/test.txt && exit 1 || echo "Gone"
|
|
|
|
|
2017-11-15 19:02:12 +00:00
|
|
|
echo "Restore backup..."
|
|
|
|
/restore.sh
|
|
|
|
|
|
|
|
echo "Verify backup..."
|
|
|
|
/verify.sh
|
2017-11-15 21:45:15 +00:00
|
|
|
|
2018-03-10 01:29:41 +00:00
|
|
|
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..."
|
2017-11-15 21:45:15 +00:00
|
|
|
export PASSPHRASE=Incorrect.Mule.Solar.Paperclip
|
|
|
|
|
|
|
|
echo "Fail to restore backup..."
|
|
|
|
/restore.sh && exit 1 || echo "OK"
|