mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Merge pull request #56611 from tianshapjq/testcase-cgroup_manager_linux.go
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. new testcase to cgroup_manager_linux.go a new test case to adaptName(), for testing "cgroupManagerType != libcontainerSystemd"
This commit is contained in:
commit
4d215fd235
@ -99,3 +99,35 @@ func TestLibcontainerAdapterAdaptToSystemdAsCgroupFs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLibcontainerAdapterNotAdaptToSystemd(t *testing.T) {
|
||||||
|
cgroupfs := newLibcontainerAdapter(libcontainerCgroupfs)
|
||||||
|
otherAdatper := newLibcontainerAdapter(libcontainerCgroupManagerType("test"))
|
||||||
|
|
||||||
|
testCases := []struct {
|
||||||
|
input string
|
||||||
|
expected string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
input: "/",
|
||||||
|
expected: "/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: "/Burstable",
|
||||||
|
expected: "/Burstable",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: "",
|
||||||
|
expected: "",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, testCase := range testCases {
|
||||||
|
if actual := cgroupfs.adaptName(CgroupName(testCase.input), true); actual != testCase.expected {
|
||||||
|
t.Errorf("Unexpected result, input: %v, expected: %v, actual: %v", testCase.input, testCase.expected, actual)
|
||||||
|
}
|
||||||
|
|
||||||
|
if actual := otherAdatper.adaptName(CgroupName(testCase.input), true); actual != testCase.expected {
|
||||||
|
t.Errorf("Unexpected result, input: %v, expected: %v, actual: %v", testCase.input, testCase.expected, actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user