Implement namespace optional arg
This commit is contained in:
16
db_test.go
16
db_test.go
@@ -15,16 +15,18 @@ type mock struct {
|
||||
m map[string][]byte
|
||||
}
|
||||
|
||||
func (mock *mock) Get(key string) ([]byte, error) {
|
||||
v, ok := mock.m[key]
|
||||
func (mock *mock) Get(key string, ns ...string) ([]byte, error) {
|
||||
namespace := resolveNamespace(ns)
|
||||
v, ok := mock.m[path.Join(namespace, key)]
|
||||
if ok {
|
||||
return v, nil
|
||||
}
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
func (mock *mock) Set(key string, value []byte) error {
|
||||
mock.m[key] = value
|
||||
func (mock *mock) Set(key string, value []byte, ns ...string) error {
|
||||
namespace := resolveNamespace(ns)
|
||||
mock.m[path.Join(namespace, key)] = value
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -118,6 +120,12 @@ func TestImplementations(t *testing.T) {
|
||||
cases = append(cases, memcacheCluster)
|
||||
}
|
||||
|
||||
if minio, err := NewMinio("localhost:9000", "accesskey", "secretkey"); err != nil {
|
||||
t.Errorf("cannot make minio: %v", err)
|
||||
} else {
|
||||
cases = append(cases, minio)
|
||||
}
|
||||
|
||||
validKey := "key"
|
||||
validValue := []byte("value")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user