aboutsummaryrefslogtreecommitdiff
path: root/weed/filer2/filechunks_test.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-08-16 00:49:26 -0700
committerChris Lu <chris.lu@gmail.com>2020-08-16 00:49:26 -0700
commit1d9ea30b7254a11232acfb265fe25954345333e6 (patch)
treeacdd78af4f43d64a7bb1883a7d34174ed37c400c /weed/filer2/filechunks_test.go
parentaec7f32b02c04aee315f67922cdb3813dbe7af72 (diff)
downloadseaweedfs-1d9ea30b7254a11232acfb265fe25954345333e6.tar.xz
seaweedfs-1d9ea30b7254a11232acfb265fe25954345333e6.zip
fix ViewFromVisibleIntervals
Diffstat (limited to 'weed/filer2/filechunks_test.go')
-rw-r--r--weed/filer2/filechunks_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/weed/filer2/filechunks_test.go b/weed/filer2/filechunks_test.go
index bfee59198..c1b0427a4 100644
--- a/weed/filer2/filechunks_test.go
+++ b/weed/filer2/filechunks_test.go
@@ -2,9 +2,13 @@ package filer2
import (
"log"
+ "math"
"testing"
"fmt"
+
+ "github.com/stretchr/testify/assert"
+
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
)
@@ -418,3 +422,30 @@ func BenchmarkCompactFileChunks(b *testing.B) {
CompactFileChunks(nil, chunks)
}
}
+
+func TestViewFromVisibleIntervals(t *testing.T) {
+ visibles := []VisibleInterval{
+ {
+ start: 0,
+ stop: 25,
+ fileId: "fid1",
+ },
+ {
+ start: 4096,
+ stop: 8192,
+ fileId: "fid2",
+ },
+ {
+ start: 16384,
+ stop: 18551,
+ fileId: "fid3",
+ },
+ }
+
+ views := ViewFromVisibleIntervals(visibles, 0, math.MaxInt32)
+
+ if len(views) != len(visibles) {
+ assert.Equal(t, len(visibles), len(views), "ViewFromVisibleIntervals error")
+ }
+
+} \ No newline at end of file