aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/storage/filestore_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'swarm/storage/filestore_test.go')
-rw-r--r--swarm/storage/filestore_test.go34
1 files changed, 17 insertions, 17 deletions
diff --git a/swarm/storage/filestore_test.go b/swarm/storage/filestore_test.go
index f3f597255..d79efb530 100644
--- a/swarm/storage/filestore_test.go
+++ b/swarm/storage/filestore_test.go
@@ -49,11 +49,11 @@ func testFileStoreRandom(toEncrypt bool, t *testing.T) {
fileStore := NewFileStore(localStore, NewFileStoreParams())
defer os.RemoveAll("/tmp/bzz")
- reader, slice := generateRandomData(testDataSize)
+ reader, slice := GenerateRandomData(testDataSize)
ctx := context.TODO()
key, wait, err := fileStore.Store(ctx, reader, testDataSize, toEncrypt)
if err != nil {
- t.Errorf("Store error: %v", err)
+ t.Fatalf("Store error: %v", err)
}
err = wait(ctx)
if err != nil {
@@ -66,13 +66,13 @@ func testFileStoreRandom(toEncrypt bool, t *testing.T) {
resultSlice := make([]byte, len(slice))
n, err := resultReader.ReadAt(resultSlice, 0)
if err != io.EOF {
- t.Errorf("Retrieve error: %v", err)
+ t.Fatalf("Retrieve error: %v", err)
}
if n != len(slice) {
- t.Errorf("Slice size error got %d, expected %d.", n, len(slice))
+ t.Fatalf("Slice size error got %d, expected %d.", n, len(slice))
}
if !bytes.Equal(slice, resultSlice) {
- t.Errorf("Comparison error.")
+ t.Fatalf("Comparison error.")
}
ioutil.WriteFile("/tmp/slice.bzz.16M", slice, 0666)
ioutil.WriteFile("/tmp/result.bzz.16M", resultSlice, 0666)
@@ -86,13 +86,13 @@ func testFileStoreRandom(toEncrypt bool, t *testing.T) {
}
n, err = resultReader.ReadAt(resultSlice, 0)
if err != io.EOF {
- t.Errorf("Retrieve error after removing memStore: %v", err)
+ t.Fatalf("Retrieve error after removing memStore: %v", err)
}
if n != len(slice) {
- t.Errorf("Slice size error after removing memStore got %d, expected %d.", n, len(slice))
+ t.Fatalf("Slice size error after removing memStore got %d, expected %d.", n, len(slice))
}
if !bytes.Equal(slice, resultSlice) {
- t.Errorf("Comparison error after removing memStore.")
+ t.Fatalf("Comparison error after removing memStore.")
}
}
@@ -114,7 +114,7 @@ func testFileStoreCapacity(toEncrypt bool, t *testing.T) {
DbStore: db,
}
fileStore := NewFileStore(localStore, NewFileStoreParams())
- reader, slice := generateRandomData(testDataSize)
+ reader, slice := GenerateRandomData(testDataSize)
ctx := context.TODO()
key, wait, err := fileStore.Store(ctx, reader, testDataSize, toEncrypt)
if err != nil {
@@ -122,7 +122,7 @@ func testFileStoreCapacity(toEncrypt bool, t *testing.T) {
}
err = wait(ctx)
if err != nil {
- t.Errorf("Store error: %v", err)
+ t.Fatalf("Store error: %v", err)
}
resultReader, isEncrypted := fileStore.Retrieve(context.TODO(), key)
if isEncrypted != toEncrypt {
@@ -131,13 +131,13 @@ func testFileStoreCapacity(toEncrypt bool, t *testing.T) {
resultSlice := make([]byte, len(slice))
n, err := resultReader.ReadAt(resultSlice, 0)
if err != io.EOF {
- t.Errorf("Retrieve error: %v", err)
+ t.Fatalf("Retrieve error: %v", err)
}
if n != len(slice) {
- t.Errorf("Slice size error got %d, expected %d.", n, len(slice))
+ t.Fatalf("Slice size error got %d, expected %d.", n, len(slice))
}
if !bytes.Equal(slice, resultSlice) {
- t.Errorf("Comparison error.")
+ t.Fatalf("Comparison error.")
}
// Clear memStore
memStore.setCapacity(0)
@@ -148,7 +148,7 @@ func testFileStoreCapacity(toEncrypt bool, t *testing.T) {
t.Fatalf("isEncrypted expected %v got %v", toEncrypt, isEncrypted)
}
if _, err = resultReader.ReadAt(resultSlice, 0); err == nil {
- t.Errorf("Was able to read %d bytes from an empty memStore.", len(slice))
+ t.Fatalf("Was able to read %d bytes from an empty memStore.", len(slice))
}
// check how it works with localStore
fileStore.ChunkStore = localStore
@@ -162,12 +162,12 @@ func testFileStoreCapacity(toEncrypt bool, t *testing.T) {
}
n, err = resultReader.ReadAt(resultSlice, 0)
if err != io.EOF {
- t.Errorf("Retrieve error after clearing memStore: %v", err)
+ t.Fatalf("Retrieve error after clearing memStore: %v", err)
}
if n != len(slice) {
- t.Errorf("Slice size error after clearing memStore got %d, expected %d.", n, len(slice))
+ t.Fatalf("Slice size error after clearing memStore got %d, expected %d.", n, len(slice))
}
if !bytes.Equal(slice, resultSlice) {
- t.Errorf("Comparison error after clearing memStore.")
+ t.Fatalf("Comparison error after clearing memStore.")
}
}