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.

34 lines
734 B

4 years ago
  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. LocationPrefix: "/buckets/",
  20. Replication: "001",
  21. },
  22. }}
  23. fc.doLoadConf(conf)
  24. assert.Equal(t, "abc", fc.MatchStorageRule("/buckets/abc/jasdf").Collection)
  25. assert.Equal(t, "abcd", fc.MatchStorageRule("/buckets/abcd/jasdf").Collection)
  26. assert.Equal(t, "001", fc.MatchStorageRule("/buckets/abc/jasdf").Replication)
  27. }