From 219c0e82bbce92bea36d1df84bb7b563b4fcef70 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 14 Jan 2015 17:43:41 +0100 Subject: [PATCH] Add test for files vanishing between scan and backup --- Makefile | 2 +- test/test-backup-missing-file.sh | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 test/test-backup-missing-file.sh diff --git a/Makefile b/Makefile index fb13ae4d7..2b9a2e019 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ test: release debug go test -v ./... test/run.sh cmd/restic:cmd/dirdiff -test-%: test/test-%.sh +test-%: test/test-%.sh release debug echo $* test/run.sh cmd/restic:cmd/dirdiff "test/$@.sh" diff --git a/test/test-backup-missing-file.sh b/test/test-backup-missing-file.sh new file mode 100755 index 000000000..2ecf6e937 --- /dev/null +++ b/test/test-backup-missing-file.sh @@ -0,0 +1,25 @@ +set -em + +# setup restic +prepare +run restic init + +# start backup, break before saving files +DEBUG_BREAK=Archiver.Snapshot run restic.debug backup "${BASE}/fake-data" && debug "done" + +# remove file +rm -f "${BASE}/fake-data/0/0/9/37" + +# resume backup +fg + +# run restic restore "$(basename "$RESTIC_REPOSITORY"/snapshots/*)" "${BASE}/fake-data-restore" +# dirdiff "${BASE}/fake-data" "${BASE}/fake-data-restore/fake-data" + +# SNAPSHOT=$(run restic list snapshots) +# run restic backup "${BASE}/fake-data" $SNAPSHOT +# run restic restore "$(basename "$RESTIC_REPOSITORY"/snapshots/*)" "${BASE}/fake-data-restore-incremental" +# dirdiff "${BASE}/fake-data" "${BASE}/fake-data-restore-incremental/fake-data" + +# run restic fsck -o --check-data +cleanup