mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 18:54:06 +00:00
Move current test under its own NodeConformance context
Signed-off-by: Itamar Holder <iholder@redhat.com>
This commit is contained in:
parent
9f344f23fb
commit
eb5d647655
@ -19,6 +19,7 @@ package e2enode
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"k8s.io/kubernetes/test/e2e/nodefeature"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@ -44,40 +45,42 @@ const (
|
|||||||
cgroupV1MemLimitFile = "/memory/memory.limit_in_bytes"
|
cgroupV1MemLimitFile = "/memory/memory.limit_in_bytes"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("Swap", framework.WithNodeConformance(), "[LinuxOnly]", func() {
|
var _ = SIGDescribe("Swap", "[LinuxOnly]", nodefeature.Swap, func() {
|
||||||
f := framework.NewDefaultFramework("swap-test")
|
f := framework.NewDefaultFramework("swap-qos")
|
||||||
f.NamespacePodSecurityLevel = admissionapi.LevelBaseline
|
f.NamespacePodSecurityLevel = admissionapi.LevelBaseline
|
||||||
|
|
||||||
ginkgo.DescribeTable("with configuration", func(qosClass v1.PodQOSClass, memoryRequestEqualLimit bool) {
|
f.Context(framework.WithNodeConformance(), func() {
|
||||||
ginkgo.By(fmt.Sprintf("Creating a pod of QOS class %s. memoryRequestEqualLimit: %t", qosClass, memoryRequestEqualLimit))
|
ginkgo.DescribeTable("with configuration", func(qosClass v1.PodQOSClass, memoryRequestEqualLimit bool) {
|
||||||
pod := getSwapTestPod(f, qosClass, memoryRequestEqualLimit)
|
ginkgo.By(fmt.Sprintf("Creating a pod of QOS class %s. memoryRequestEqualLimit: %t", qosClass, memoryRequestEqualLimit))
|
||||||
pod = runPodAndWaitUntilScheduled(f, pod)
|
pod := getSwapTestPod(f, qosClass, memoryRequestEqualLimit)
|
||||||
|
pod = runPodAndWaitUntilScheduled(f, pod)
|
||||||
|
|
||||||
isCgroupV2 := isPodCgroupV2(f, pod)
|
isCgroupV2 := isPodCgroupV2(f, pod)
|
||||||
isLimitedSwap := isLimitedSwap(f, pod)
|
isLimitedSwap := isLimitedSwap(f, pod)
|
||||||
isNoSwap := isNoSwap(f, pod)
|
isNoSwap := isNoSwap(f, pod)
|
||||||
|
|
||||||
if !isSwapFeatureGateEnabled() || !isCgroupV2 || isNoSwap || (isLimitedSwap && (qosClass != v1.PodQOSBurstable || memoryRequestEqualLimit)) {
|
if !isSwapFeatureGateEnabled() || !isCgroupV2 || isNoSwap || (isLimitedSwap && (qosClass != v1.PodQOSBurstable || memoryRequestEqualLimit)) {
|
||||||
ginkgo.By(fmt.Sprintf("Expecting no swap. isNoSwap? %t, feature gate on? %t isCgroupV2? %t is QoS burstable? %t", isNoSwap, isSwapFeatureGateEnabled(), isCgroupV2, qosClass == v1.PodQOSBurstable))
|
ginkgo.By(fmt.Sprintf("Expecting no swap. isNoSwap? %t, feature gate on? %t isCgroupV2? %t is QoS burstable? %t", isNoSwap, isSwapFeatureGateEnabled(), isCgroupV2, qosClass == v1.PodQOSBurstable))
|
||||||
expectNoSwap(f, pod, isCgroupV2)
|
expectNoSwap(f, pod, isCgroupV2)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isLimitedSwap {
|
if !isLimitedSwap {
|
||||||
ginkgo.By("expecting no swap")
|
ginkgo.By("expecting no swap")
|
||||||
expectNoSwap(f, pod, isCgroupV2)
|
expectNoSwap(f, pod, isCgroupV2)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ginkgo.By("expecting limited swap")
|
ginkgo.By("expecting limited swap")
|
||||||
expectedSwapLimit := calcSwapForBurstablePod(f, pod)
|
expectedSwapLimit := calcSwapForBurstablePod(f, pod)
|
||||||
expectLimitedSwap(f, pod, expectedSwapLimit)
|
expectLimitedSwap(f, pod, expectedSwapLimit)
|
||||||
},
|
},
|
||||||
ginkgo.Entry("QOS Best-effort", v1.PodQOSBestEffort, false),
|
ginkgo.Entry("QOS Best-effort", v1.PodQOSBestEffort, false),
|
||||||
ginkgo.Entry("QOS Burstable", v1.PodQOSBurstable, false),
|
ginkgo.Entry("QOS Burstable", v1.PodQOSBurstable, false),
|
||||||
ginkgo.Entry("QOS Burstable with memory request equals to limit", v1.PodQOSBurstable, true),
|
ginkgo.Entry("QOS Burstable with memory request equals to limit", v1.PodQOSBurstable, true),
|
||||||
ginkgo.Entry("QOS Guaranteed", v1.PodQOSGuaranteed, false),
|
ginkgo.Entry("QOS Guaranteed", v1.PodQOSGuaranteed, false),
|
||||||
)
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// Note that memoryRequestEqualLimit is effective only when qosClass is PodQOSBestEffort.
|
// Note that memoryRequestEqualLimit is effective only when qosClass is PodQOSBestEffort.
|
||||||
|
Loading…
Reference in New Issue
Block a user