diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-11-15 00:26:05 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-11-15 00:26:05 -0800 |
| commit | 0a406f652ee1104b038e518145e5c3e0008ce4c4 (patch) | |
| tree | 65c127c246f256c3f7accc2894808ab3cac04fe0 /weed/filer/filer_conf_test.go | |
| parent | 68043cfcacd4c35e86d063a08bf0de2cfbf5f7ad (diff) | |
| download | seaweedfs-0a406f652ee1104b038e518145e5c3e0008ce4c4.tar.xz seaweedfs-0a406f652ee1104b038e518145e5c3e0008ce4c4.zip | |
load filer conf and match by prefix
Diffstat (limited to 'weed/filer/filer_conf_test.go')
| -rw-r--r-- | weed/filer/filer_conf_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/weed/filer/filer_conf_test.go b/weed/filer/filer_conf_test.go new file mode 100644 index 000000000..6a7b875d3 --- /dev/null +++ b/weed/filer/filer_conf_test.go @@ -0,0 +1,31 @@ +package filer + +import ( + "testing" + + "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" + "github.com/stretchr/testify/assert" + "github.com/viant/ptrie" +) + +func TestFilerConf(t *testing.T) { + + fc := &FilerConf{ + rules: ptrie.New(), + } + conf := &filer_pb.FilerConf{Locations: []*filer_pb.FilerConf_PathConf{ + { + LocationPrefix: "/buckets/abc", + Collection: "abc", + }, + { + LocationPrefix: "/buckets/abcd", + Collection: "abcd", + }, + }} + fc.doLoadConf(conf) + + assert.Equal(t, "abc", fc.MatchStorageRule("/buckets/abc/jasdf").Collection) + assert.Equal(t, "abcd", fc.MatchStorageRule("/buckets/abcd/jasdf").Collection) + +} |
