From e350ba88965bbfc2275de98232572f127caa5a59 Mon Sep 17 00:00:00 2001 From: chrislu Date: Fri, 6 May 2022 02:17:28 -0700 Subject: [PATCH] larger test range --- weed/filer/store_test/test_suite.go | 35 +++++++++-------------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/weed/filer/store_test/test_suite.go b/weed/filer/store_test/test_suite.go index 6b1b60f5e..ad578442c 100644 --- a/weed/filer/store_test/test_suite.go +++ b/weed/filer/store_test/test_suite.go @@ -2,6 +2,7 @@ package store_test import ( "context" + "fmt" "github.com/chrislusf/seaweedfs/weed/filer" "github.com/chrislusf/seaweedfs/weed/util" "github.com/stretchr/testify/assert" @@ -16,11 +17,9 @@ func TestFilerStore(t *testing.T, store filer.FilerStore) { store.InsertEntry(ctx, makeEntry(util.FullPath("/a"), true)) store.InsertEntry(ctx, makeEntry(util.FullPath("/a/b"), true)) store.InsertEntry(ctx, makeEntry(util.FullPath("/a/b/c"), true)) - store.InsertEntry(ctx, makeEntry(util.FullPath("/a/b/c/f1"), false)) - store.InsertEntry(ctx, makeEntry(util.FullPath("/a/b/c/f2"), false)) - store.InsertEntry(ctx, makeEntry(util.FullPath("/a/b/c/f3"), false)) - store.InsertEntry(ctx, makeEntry(util.FullPath("/a/b/c/f4"), false)) - store.InsertEntry(ctx, makeEntry(util.FullPath("/a/b/c/f5"), false)) + for i := 0; i < 2000; i++ { + store.InsertEntry(ctx, makeEntry(util.FullPath(fmt.Sprintf("/a/b/c/f%05d", i)), false)) + } { var counter int @@ -28,28 +27,16 @@ func TestFilerStore(t *testing.T, store filer.FilerStore) { counter++ return true }) - if err != nil { - t.Errorf("list directory: %v", err) - } - if counter != 3 { - assert.Equal(t, 3, counter, "directory list counter") - } - if lastFileName != "f3" { - assert.Equal(t, "f3", lastFileName, "directory list last file") - } - lastFileName, err = store.ListDirectoryEntries(ctx, util.FullPath("/a/b/c"), lastFileName, false, 3, func(entry *filer.Entry) bool { + assert.Nil(t, err, "list directory") + assert.Equal(t, 3, counter, "directory list counter") + assert.Equal(t, "f00003", lastFileName, "directory list last file") + lastFileName, err = store.ListDirectoryEntries(ctx, util.FullPath("/a/b/c"), lastFileName, false, 1024, func(entry *filer.Entry) bool { counter++ return true }) - if err != nil { - t.Errorf("list directory: %v", err) - } - if counter != 5 { - assert.Equal(t, 5, counter, "directory list counter") - } - if lastFileName != "f5" { - assert.Equal(t, "f5", lastFileName, "directory list last file") - } + assert.Nil(t, err, "list directory") + assert.Equal(t, 1027, counter, "directory list counter") + assert.Equal(t, "f01027", lastFileName, "directory list last file") } }