mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 00:57:27 +00:00
cinder attacher GetDeviceMountPath
add function to test GetDeviceMountPath func return value
This commit is contained in:
parent
9484212b00
commit
430abfbdfe
@ -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
|
// One testcase for TestAttachDetach table test below
|
||||||
type testcase struct {
|
type testcase struct {
|
||||||
name string
|
name string
|
||||||
|
Loading…
Reference in New Issue
Block a user