You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
588 B

  1. package filer
  2. import (
  3. "testing"
  4. "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
  5. "github.com/stretchr/testify/assert"
  6. )
  7. func TestFilerConf(t *testing.T) {
  8. fc := NewFilerConf()
  9. conf := &filer_pb.FilerConf{Locations: []*filer_pb.FilerConf_PathConf{
  10. {
  11. LocationPrefix: "/buckets/abc",
  12. Collection: "abc",
  13. },
  14. {
  15. LocationPrefix: "/buckets/abcd",
  16. Collection: "abcd",
  17. },
  18. }}
  19. fc.doLoadConf(conf)
  20. assert.Equal(t, "abc", fc.MatchStorageRule("/buckets/abc/jasdf").Collection)
  21. assert.Equal(t, "abcd", fc.MatchStorageRule("/buckets/abcd/jasdf").Collection)
  22. }