Merge pull request #38374 from NickrenREN/cinder-getDeviceMountPath-test

Automatic merge from submit-queue

cinder attacher GetDeviceMountPath
This commit is contained in:
Kubernetes Submit Queue 2016-12-20 19:16:26 -08:00 committed by GitHub
commit abe2b3ce1c

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