mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Merge pull request #80848 from cwdsuzhou/Aug/fix_ut
Fix some unreasonable places int csi ut
This commit is contained in:
commit
4ce69dd32e
@ -84,10 +84,10 @@ func TestMounterGetPath(t *testing.T) {
|
|||||||
}
|
}
|
||||||
csiMounter := mounter.(*csiMountMgr)
|
csiMounter := mounter.(*csiMountMgr)
|
||||||
|
|
||||||
path := csiMounter.GetPath()
|
mountPath := csiMounter.GetPath()
|
||||||
|
|
||||||
if tc.path != path {
|
if tc.path != mountPath {
|
||||||
t.Errorf("expecting path %s, got %s", tc.path, path)
|
t.Errorf("expecting path %s, got %s", tc.path, mountPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -226,10 +226,10 @@ func MounterSetUpTests(t *testing.T, podInfoEnabled bool) {
|
|||||||
t.Errorf("default value of file system type was overridden by type %s", csiMounter.spec.PersistentVolume.Spec.CSI.FSType)
|
t.Errorf("default value of file system type was overridden by type %s", csiMounter.spec.PersistentVolume.Spec.CSI.FSType)
|
||||||
}
|
}
|
||||||
|
|
||||||
path := csiMounter.GetPath()
|
mountPath := csiMounter.GetPath()
|
||||||
if _, err := os.Stat(path); err != nil {
|
if _, err := os.Stat(mountPath); err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
t.Errorf("SetUp() failed, volume path not created: %s", path)
|
t.Errorf("SetUp() failed, volume path not created: %s", mountPath)
|
||||||
} else {
|
} else {
|
||||||
t.Errorf("SetUp() failed: %v", err)
|
t.Errorf("SetUp() failed: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -549,12 +549,11 @@ func TestPluginNewMounter(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
t.Run(test.name, func(t *testing.T) {
|
||||||
plug, tmpDir := newTestPlugin(t, nil)
|
plug, tmpDir := newTestPlugin(t, nil)
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
registerFakePlugin(testDriver, "endpoint", []string{"1.2.0"}, t)
|
registerFakePlugin(testDriver, "endpoint", []string{"1.2.0"}, t)
|
||||||
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
|
||||||
mounter, err := plug.NewMounter(
|
mounter, err := plug.NewMounter(
|
||||||
test.spec,
|
test.spec,
|
||||||
&api.Pod{ObjectMeta: meta.ObjectMeta{UID: test.podUID, Namespace: test.namespace}},
|
&api.Pod{ObjectMeta: meta.ObjectMeta{UID: test.podUID, Namespace: test.namespace}},
|
||||||
@ -668,12 +667,11 @@ func TestPluginNewMounterWithInline(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
t.Run(test.name, func(t *testing.T) {
|
||||||
plug, tmpDir := newTestPlugin(t, nil)
|
plug, tmpDir := newTestPlugin(t, nil)
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
registerFakePlugin(testDriver, "endpoint", []string{"1.2.0"}, t)
|
registerFakePlugin(testDriver, "endpoint", []string{"1.2.0"}, t)
|
||||||
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
|
||||||
mounter, err := plug.NewMounter(
|
mounter, err := plug.NewMounter(
|
||||||
test.spec,
|
test.spec,
|
||||||
&api.Pod{ObjectMeta: meta.ObjectMeta{UID: test.podUID, Namespace: test.namespace}},
|
&api.Pod{ObjectMeta: meta.ObjectMeta{UID: test.podUID, Namespace: test.namespace}},
|
||||||
|
@ -64,6 +64,7 @@ func TestNodeExpand(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
plug, tmpDir := newTestPlugin(t, nil)
|
plug, tmpDir := newTestPlugin(t, nil)
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
@ -90,5 +91,6 @@ func TestNodeExpand(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user