From 734ae7fcb8064d5e2fe9488f2ad575262f8c89ec Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 25 Oct 2015 21:51:57 +0100 Subject: [PATCH] Add test for corner case It was observed that a restic repository still contained overlapping indexes after `rebuild-index` has been called. This is caused by instantly forgetting that blobs have already been saved once a full index has been written during index rebuilding. This commit adds a (failing) test that shows the behaviour. --- cmd/restic/integration_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/restic/integration_test.go b/cmd/restic/integration_test.go index c2d5f7197..fa95eca92 100644 --- a/cmd/restic/integration_test.go +++ b/cmd/restic/integration_test.go @@ -18,6 +18,7 @@ import ( "github.com/restic/restic/backend" "github.com/restic/restic/debug" "github.com/restic/restic/filter" + "github.com/restic/restic/repository" . "github.com/restic/restic/test" ) @@ -683,3 +684,8 @@ func TestRebuildIndex(t *testing.T) { } }) } + +func TestRebuildIndexAlwaysFull(t *testing.T) { + repository.IndexFull = func(*repository.Index) bool { return true } + TestRebuildIndex(t) +}