summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorAlexander Neumann <alexander@bumpern.de>2015-11-08 22:38:17 +0100
committerAlexander Neumann <alexander@bumpern.de>2015-11-08 22:38:17 +0100
commit742d69bf4d3913d459fe02ecd0adefbfaf4dd15c (patch)
treed3a4685aa2e8039e62f35e839988d56f99efd3e8 /cmd
parent5776b8f01cf2bf8f7d2449f0408b247bd9ba188a (diff)
Add another test for optimizing unused blobs
Diffstat (limited to 'cmd')
-rw-r--r--cmd/restic/integration_test.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/cmd/restic/integration_test.go b/cmd/restic/integration_test.go
index 01bb0b14a..baf12fe02 100644
--- a/cmd/restic/integration_test.go
+++ b/cmd/restic/integration_test.go
@@ -701,15 +701,22 @@ func TestRebuildIndexAlwaysFull(t *testing.T) {
var optimizeTests = []struct {
testFilename string
- snapshotID string
+ snapshots backend.IDSet
}{
{
filepath.Join("..", "..", "checker", "testdata", "checker-test-repo.tar.gz"),
- "a13c11e582b77a693dd75ab4e3a3ba96538a056594a4b9076e4cacebe6e06d43",
+ backend.NewIDSet(ParseID("a13c11e582b77a693dd75ab4e3a3ba96538a056594a4b9076e4cacebe6e06d43")),
},
{
filepath.Join("testdata", "old-index-repo.tar.gz"),
- "",
+ nil,
+ },
+ {
+ filepath.Join("testdata", "old-index-repo.tar.gz"),
+ backend.NewIDSet(
+ ParseID("f7d83db709977178c9d1a09e4009355e534cde1a135b8186b8b118a3fc4fcd41"),
+ ParseID("51d249d28815200d59e4be7b3f21a157b864dc343353df9d8e498220c2499b02"),
+ ),
},
}
@@ -718,8 +725,8 @@ func TestOptimizeRemoveUnusedBlobs(t *testing.T) {
withTestEnvironment(t, func(env *testEnvironment, global GlobalOptions) {
SetupTarTestFixture(t, env.base, test.testFilename)
- if test.snapshotID != "" {
- OK(t, os.Remove(filepath.Join(env.repo, "snapshots", test.snapshotID)))
+ for id := range test.snapshots {
+ OK(t, os.Remove(filepath.Join(env.repo, "snapshots", id.String())))
}
cmdOptimize(t, global)