cinder attacher GetDeviceMountPath

add function to test GetDeviceMountPath func return value
This commit is contained in:
NickrenREN 2016-12-08 17:30:44 +08:00
parent 9484212b00
commit 430abfbdfe

View File

@ -57,6 +57,27 @@ func TestGetDeviceName_PersistentVolume(t *testing.T) {
}
}
func TestGetDeviceMountPath(t *testing.T) {
name := "cinder-volume-id"
spec := createVolSpec(name, false)
rootDir := "/var/lib/kubelet/"
host := volumetest.NewFakeVolumeHost(rootDir, nil, nil)
attacher := &cinderDiskAttacher{
host: host,
}
//test the path
path, err := attacher.GetDeviceMountPath(spec)
if err != nil {
t.Errorf("Get device mount path error")
}
expectedPath := rootDir + "plugins/kubernetes.io/cinder/mounts/" + name
if path != expectedPath {
t.Errorf("Device mount path error: expected %s, got %s ", expectedPath, path)
}
}
// One testcase for TestAttachDetach table test below
type testcase struct {
name string