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
34 lines
734 B
package filer
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestFilerConf(t *testing.T) {
|
|
|
|
fc := NewFilerConf()
|
|
|
|
conf := &filer_pb.FilerConf{Locations: []*filer_pb.FilerConf_PathConf{
|
|
{
|
|
LocationPrefix: "/buckets/abc",
|
|
Collection: "abc",
|
|
},
|
|
{
|
|
LocationPrefix: "/buckets/abcd",
|
|
Collection: "abcd",
|
|
},
|
|
{
|
|
LocationPrefix: "/buckets/",
|
|
Replication: "001",
|
|
},
|
|
}}
|
|
fc.doLoadConf(conf)
|
|
|
|
assert.Equal(t, "abc", fc.MatchStorageRule("/buckets/abc/jasdf").Collection)
|
|
assert.Equal(t, "abcd", fc.MatchStorageRule("/buckets/abcd/jasdf").Collection)
|
|
assert.Equal(t, "001", fc.MatchStorageRule("/buckets/abc/jasdf").Replication)
|
|
|
|
}
|