Re-enable dedup, add test (closes #95)

This commit is contained in:
Alexander Neumann 2015-03-07 12:05:33 +01:00
parent 03bdbb064f
commit 798ac97a52
2 changed files with 32 additions and 9 deletions

View file

@ -217,16 +217,16 @@ func (cmd CmdBackup) Execute(args []string) error {
return nil return nil
} }
// fmt.Printf("loading blobs\n") fmt.Printf("loading blobs\n")
// pb, err := newLoadBlobsProgress(s) pb, err := newLoadBlobsProgress(s)
// if err != nil { if err != nil {
// return err return err
// } }
// err = arch.Preload(pb) err = arch.Preload(pb)
// if err != nil { if err != nil {
// return err return err
// } }
_, id, err := arch.Snapshot(newArchiveProgress(stat), target, parentSnapshotID) _, id, err := arch.Snapshot(newArchiveProgress(stat), target, parentSnapshotID)
if err != nil { if err != nil {

23
testsuite/test-backup-dedup.sh Executable file
View file

@ -0,0 +1,23 @@
set -e
prepare
run restic init
# first backup without dedup
run restic backup "${BASE}/fake-data"
size=$(du -sm "$RESTIC_REPOSITORY" | cut -f1)
debug "size before: $size"
# second backup with dedup
run restic backup "${BASE}/fake-data"
size2=$(du -sm "$RESTIC_REPOSITORY" | cut -f1)
debug "size after: $size2"
# check if the repository hasn't grown more than 5%
threshhold=$(($size+$size/20))
debug "threshhold is $threshhold"
if [[ "$size2" -gt "$threshhold" ]]; then
fail "dedup failed, repo grown more than 5%, before ${size}MiB after ${size2}MiB threshhold ${threshhold}MiB"
fi
cleanup