Refactor cache refresh for blobs, add progress

This commit is contained in:
Alexander Neumann
2015-03-22 15:09:50 +01:00
parent 702cf3c2ff
commit cfa2229bc0
4 changed files with 89 additions and 14 deletions
+15 -1
View File
@@ -36,8 +36,22 @@ func TestCache(t *testing.T) {
// remove cached blob list
ok(t, cache.Purge(backend.Snapshot, "blobs", id))
// load map from cache again, this should fail
rd, err = cache.Load(backend.Snapshot, "blobs", id)
assert(t, err != nil, "Expected failure did not occur")
// recreate cached blob list
m2, err := restic.CacheSnapshotBlobs(server, cache, id)
err = cache.RefreshSnapshots(server, nil)
ok(t, err)
// load map from cache again
rd, err = cache.Load(backend.Snapshot, "blobs", id)
ok(t, err)
dec = json.NewDecoder(rd)
m2 := &restic.Map{}
err = dec.Decode(m2)
ok(t, err)
// compare maps