mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-12-10 03:37:31 +00:00
This commit contains the following:
1. Scheduler bug-fix + scheduler-focussed E2E tests 2. Add cgroup v2 support for in-place pod resize 3. Enable full E2E pod resize test for containerd>=1.6.9 and EventedPLEG related changes. Co-Authored-By: Vinay Kulkarni <vskibum@gmail.com>
This commit is contained in:
committed by
vinay kulkarni
parent
f2bd94a0de
commit
7db339dba2
@@ -169,3 +169,85 @@ func TestParseSystemdToCgroupName(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCpuSharesToCpuWeight(t *testing.T) {
|
||||
testCases := []struct {
|
||||
cpuShares uint64
|
||||
expectedCpuWeight uint64
|
||||
}{
|
||||
{
|
||||
cpuShares: 2,
|
||||
expectedCpuWeight: 1,
|
||||
},
|
||||
{
|
||||
cpuShares: 3,
|
||||
expectedCpuWeight: 1,
|
||||
},
|
||||
{
|
||||
cpuShares: 4,
|
||||
expectedCpuWeight: 1,
|
||||
},
|
||||
{
|
||||
cpuShares: 28,
|
||||
expectedCpuWeight: 1,
|
||||
},
|
||||
{
|
||||
cpuShares: 29,
|
||||
expectedCpuWeight: 2,
|
||||
},
|
||||
{
|
||||
cpuShares: 245,
|
||||
expectedCpuWeight: 10,
|
||||
},
|
||||
{
|
||||
cpuShares: 262144,
|
||||
expectedCpuWeight: 10000,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
if actual := CpuSharesToCpuWeight(testCase.cpuShares); actual != testCase.expectedCpuWeight {
|
||||
t.Errorf("cpuShares: %v, expectedCpuWeight: %v, actualCpuWeight: %v",
|
||||
testCase.cpuShares, testCase.expectedCpuWeight, actual)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCpuWeightToCpuShares(t *testing.T) {
|
||||
testCases := []struct {
|
||||
cpuWeight uint64
|
||||
expectedCpuShares uint64
|
||||
}{
|
||||
{
|
||||
cpuWeight: 1,
|
||||
expectedCpuShares: 2,
|
||||
},
|
||||
{
|
||||
cpuWeight: 2,
|
||||
expectedCpuShares: 28,
|
||||
},
|
||||
{
|
||||
cpuWeight: 3,
|
||||
expectedCpuShares: 54,
|
||||
},
|
||||
{
|
||||
cpuWeight: 4,
|
||||
expectedCpuShares: 80,
|
||||
},
|
||||
{
|
||||
cpuWeight: 245,
|
||||
expectedCpuShares: 6398,
|
||||
},
|
||||
{
|
||||
cpuWeight: 10000,
|
||||
expectedCpuShares: 262144,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
if actual := CpuWeightToCpuShares(testCase.cpuWeight); actual != testCase.expectedCpuShares {
|
||||
t.Errorf("cpuWeight: %v, expectedCpuShares: %v, actualCpuShares: %v",
|
||||
testCase.cpuWeight, testCase.expectedCpuShares, actual)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user