aboutsummaryrefslogtreecommitdiff
path: root/repo_test.go
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-09-20 11:06:47 +0200
committern-peugnet <n.peugnet@free.fr>2021-09-20 11:44:32 +0200
commit81f191fdcd347df0b7ae52e061c9ab39e88bdbb1 (patch)
tree489fff15739ba095f75223b460bec48d034c06a6 /repo_test.go
parent129032a13d19d500011fe23bcdd232b87eeb9b2f (diff)
downloaddna-backup-81f191fdcd347df0b7ae52e061c9ab39e88bdbb1.tar.gz
dna-backup-81f191fdcd347df0b7ae52e061c9ab39e88bdbb1.zip
store fileList compressed
for now using zlib on a 556Mo dir: files: 1469447 o -> 207289 o size divided by 7
Diffstat (limited to 'repo_test.go')
-rw-r--r--repo_test.go24
1 files changed, 8 insertions, 16 deletions
diff --git a/repo_test.go b/repo_test.go
index cf88224..e1a80a3 100644
--- a/repo_test.go
+++ b/repo_test.go
@@ -131,8 +131,8 @@ func TestLoadChunks(t *testing.T) {
resultDir := t.TempDir()
dataDir := filepath.Join("testdata", "logs")
repo := NewRepo(resultDir)
- repo.chunkReadWrapper = dummyReader
- repo.chunkWriteWrapper = dummyWriter
+ repo.chunkReadWrapper = utils.NopReadWrapper
+ repo.chunkWriteWrapper = utils.NopWriteWrapper
resultVersion := filepath.Join(resultDir, "00000")
resultChunks := filepath.Join(resultVersion, chunksName)
os.MkdirAll(resultChunks, 0775)
@@ -200,14 +200,6 @@ func getDataStream(dataDir string, streamFunc func([]File, io.WriteCloser)) io.R
return reader
}
-func dummyReader(r io.Reader) (io.ReadCloser, error) {
- return io.NopCloser(r), nil
-}
-
-func dummyWriter(w io.Writer) io.WriteCloser {
- return utils.NopCloser(w)
-}
-
func TestBsdiff(t *testing.T) {
resultDir := t.TempDir()
repo := NewRepo(resultDir)
@@ -224,8 +216,8 @@ func TestBsdiff(t *testing.T) {
defer os.Remove(addedFile2)
// configure repo
- repo.chunkReadWrapper = dummyReader
- repo.chunkWriteWrapper = dummyWriter
+ repo.chunkReadWrapper = utils.NopReadWrapper
+ repo.chunkWriteWrapper = utils.NopWriteWrapper
// Load previously stored chunks
oldChunks := make(chan IdentifiedChunk, 16)
@@ -254,8 +246,8 @@ func TestCommit(t *testing.T) {
source := filepath.Join("testdata", "logs")
expected := filepath.Join("testdata", "repo_8k")
repo := NewRepo(dest)
- repo.chunkReadWrapper = dummyReader
- repo.chunkWriteWrapper = dummyWriter
+ repo.chunkReadWrapper = utils.NopReadWrapper
+ repo.chunkWriteWrapper = utils.NopWriteWrapper
repo.Commit(source)
assertSameTree(t, assertCompatibleRepoFile, expected, dest, "Commit")
@@ -278,8 +270,8 @@ func TestRestore(t *testing.T) {
source := filepath.Join("testdata", "repo_8k")
expected := filepath.Join("testdata", "logs")
repo := NewRepo(source)
- repo.chunkReadWrapper = dummyReader
- repo.chunkWriteWrapper = dummyWriter
+ repo.chunkReadWrapper = utils.NopReadWrapper
+ repo.chunkWriteWrapper = utils.NopWriteWrapper
repo.Restore(dest)
assertSameTree(t, assertSameFile, expected, dest, "Restore")