aboutsummaryrefslogtreecommitdiff
path: root/repo_test.go
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-09-02 17:48:23 +0200
committern-peugnet <n.peugnet@free.fr>2021-09-02 17:48:23 +0200
commitd9703a9daa05f30e77bb99393eab8a0d40e788e4 (patch)
tree813f08947ad0958dd3c42f7db62bd39fe6430bbf /repo_test.go
parent2a048d5d8b2b25326685ba53fc390781ba96deed (diff)
downloaddna-backup-d9703a9daa05f30e77bb99393eab8a0d40e788e4.tar.gz
dna-backup-d9703a9daa05f30e77bb99393eab8a0d40e788e4.zip
hash and store chunks left by matchStream
Diffstat (limited to 'repo_test.go')
-rw-r--r--repo_test.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/repo_test.go b/repo_test.go
index 694c413..21eccac 100644
--- a/repo_test.go
+++ b/repo_test.go
@@ -94,7 +94,7 @@ func TestLoadChunks(t *testing.T) {
reader2, writer2 := io.Pipe()
chunks1 := make(chan []byte, 16)
chunks2 := make(chan []byte, 16)
- chunks3 := make(chan StoredChunk, 16)
+ chunks3 := make(chan IdentifiedChunk, 16)
files := listFiles(dataDir)
go concatFiles(files, writer1)
go concatFiles(files, writer2)
@@ -185,14 +185,15 @@ func TestBsdiff(t *testing.T) {
defer os.Remove(addedFile2)
// Load previously stored chunks
- oldChunks := make(chan StoredChunk, 16)
+ oldChunks := make(chan IdentifiedChunk, 16)
versions := repo.loadVersions()
+ newVersion := len(versions)
go repo.loadChunks(versions, oldChunks)
repo.hashChunks(oldChunks)
// Read new data
reader := getDataStream(dataDir, concatFiles)
- recipe := repo.matchStream(reader)
+ recipe := repo.matchStream(reader, newVersion)
newChunks := extractDeltaChunks(repo.mergeTempChunks(recipe))
assertLen(t, 2, newChunks, "New delta chunks:")
for _, c := range newChunks {