mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 18:58:18 +00:00
Eviction manager needs to start as runtime dependent module
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"testing"
|
||||
|
||||
cadvisorapi "github.com/google/cadvisor/info/v1"
|
||||
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
|
||||
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
|
||||
kubecontainertest "k8s.io/kubernetes/pkg/kubelet/container/testing"
|
||||
)
|
||||
@@ -232,3 +233,37 @@ func TestGetContainerInfoWithNoMatchingContainers(t *testing.T) {
|
||||
}
|
||||
mockCadvisor.AssertExpectations(t)
|
||||
}
|
||||
|
||||
func TestHasDedicatedImageFs(t *testing.T) {
|
||||
testCases := map[string]struct {
|
||||
imageFsInfo cadvisorapiv2.FsInfo
|
||||
rootFsInfo cadvisorapiv2.FsInfo
|
||||
expected bool
|
||||
}{
|
||||
"has-dedicated-image-fs": {
|
||||
imageFsInfo: cadvisorapiv2.FsInfo{Device: "123"},
|
||||
rootFsInfo: cadvisorapiv2.FsInfo{Device: "456"},
|
||||
expected: true,
|
||||
},
|
||||
"has-unified-image-fs": {
|
||||
imageFsInfo: cadvisorapiv2.FsInfo{Device: "123"},
|
||||
rootFsInfo: cadvisorapiv2.FsInfo{Device: "123"},
|
||||
expected: false,
|
||||
},
|
||||
}
|
||||
for testName, testCase := range testCases {
|
||||
testKubelet := newTestKubelet(t, false /* controllerAttachDetachEnabled */)
|
||||
kubelet := testKubelet.kubelet
|
||||
mockCadvisor := testKubelet.fakeCadvisor
|
||||
mockCadvisor.On("Start").Return(nil)
|
||||
mockCadvisor.On("ImagesFsInfo").Return(testCase.imageFsInfo, nil)
|
||||
mockCadvisor.On("RootFsInfo").Return(testCase.rootFsInfo, nil)
|
||||
actual, err := kubelet.HasDedicatedImageFs()
|
||||
if err != nil {
|
||||
t.Errorf("case: %s, unexpected error: %v", testName, err)
|
||||
}
|
||||
if actual != testCase.expected {
|
||||
t.Errorf("case: %s, expected: %v, actual: %v", testName, testCase.expected, actual)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user