Merge pull request #93723 from ynqa/add-testcases-kubelet-getters

add testcases for kubelet getters
This commit is contained in:
Kubernetes Prow Robot 2020-08-27 16:06:58 -07:00 committed by GitHub
commit 69d5d620a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,10 @@ func TestKubeletDirs(t *testing.T) {
exp = filepath.Join(root, "plugins")
assert.Equal(t, exp, got)
got = kubelet.getPluginsRegistrationDir()
exp = filepath.Join(root, "plugins_registry")
assert.Equal(t, exp, got)
got = kubelet.getPluginDir("foobar")
exp = filepath.Join(root, "plugins/foobar")
assert.Equal(t, exp, got)
@ -55,6 +59,14 @@ func TestKubeletDirs(t *testing.T) {
exp = filepath.Join(root, "pods/abc123/volumes/plugin/foobar")
assert.Equal(t, exp, got)
got = kubelet.getPodVolumeDevicesDir("abc123")
exp = filepath.Join(root, "pods/abc123/volumeDevices")
assert.Equal(t, exp, got)
got = kubelet.getPodVolumeDeviceDir("abc123", "plugin")
exp = filepath.Join(root, "pods/abc123/volumeDevices/plugin")
assert.Equal(t, exp, got)
got = kubelet.getPodPluginsDir("abc123")
exp = filepath.Join(root, "pods/abc123/plugins")
assert.Equal(t, exp, got)
@ -63,7 +75,19 @@ func TestKubeletDirs(t *testing.T) {
exp = filepath.Join(root, "pods/abc123/plugins/foobar")
assert.Equal(t, exp, got)
got = kubelet.getVolumeDevicePluginsDir()
exp = filepath.Join(root, "plugins")
assert.Equal(t, exp, got)
got = kubelet.getVolumeDevicePluginDir("foobar")
exp = filepath.Join(root, "plugins", "foobar", "volumeDevices")
assert.Equal(t, exp, got)
got = kubelet.getPodContainerDir("abc123", "def456")
exp = filepath.Join(root, "pods/abc123/containers/def456")
assert.Equal(t, exp, got)
got = kubelet.getPodResourcesDir()
exp = filepath.Join(root, "pod-resources")
assert.Equal(t, exp, got)
}