mirror of
https://github.com/ceph/go-ceph
synced 2025-03-01 00:50:30 +00:00
rbd admin: add tests for the LevelSpec type
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
b242e6b449
commit
ac2026b118
32
rbd/admin/admin_test.go
Normal file
32
rbd/admin/admin_test.go
Normal file
@ -0,0 +1,32 @@
|
||||
// +build !nautilus
|
||||
|
||||
package admin
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestLevelSpec(t *testing.T) {
|
||||
ls := NewLevelSpec("bob", "", "")
|
||||
assert.Equal(t, "bob/", ls.spec)
|
||||
|
||||
ls = NewLevelSpec("bob", "", "foo")
|
||||
assert.Equal(t, "bob/foo", ls.spec)
|
||||
|
||||
ls = NewLevelSpec("bob", "ns", "foo")
|
||||
assert.Equal(t, "bob/ns/foo", ls.spec)
|
||||
|
||||
ls = NewLevelSpec("bob", "ns", "")
|
||||
assert.Equal(t, "bob/ns/", ls.spec)
|
||||
}
|
||||
|
||||
func TestRawLevelSpec(t *testing.T) {
|
||||
rls := NewRawLevelSpec("foo/bar")
|
||||
assert.Equal(t, "foo/bar", rls.spec)
|
||||
|
||||
// NewRawLevelSpec takes whatever junk it's given and does not validate
|
||||
rls = NewRawLevelSpec("totally! invalid! haha. ha...")
|
||||
assert.Equal(t, "totally! invalid! haha. ha...", rls.spec)
|
||||
}
|
Loading…
Reference in New Issue
Block a user