Merge pull request #36828 from mtaufen/eviction-test-thresholds

Automatic merge from submit-queue (batch tested with PRs 42216, 42136, 42183, 42149, 36828)

Set custom threshold for memory eviction test

I am hoping this helps with memory eviction flakes, e.g. https://github.com/kubernetes/kubernetes/issues/32433 and https://github.com/kubernetes/kubernetes/issues/31676

/cc @derekwaynecarr @calebamiles @dchen1107
This commit is contained in:
Kubernetes Submit Queue 2017-02-28 21:17:05 -08:00 committed by GitHub
commit cda109d224

View File

@ -25,6 +25,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/apis/componentconfig"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
@ -35,16 +36,26 @@ import (
// https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/kubelet-eviction.md // https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/kubelet-eviction.md
var _ = framework.KubeDescribe("MemoryEviction [Slow] [Serial] [Disruptive]", func() { var _ = framework.KubeDescribe("MemoryEviction [Slow] [Serial] [Disruptive]", func() {
const (
evictionHard = "memory.available<40%"
)
f := framework.NewDefaultFramework("eviction-test") f := framework.NewDefaultFramework("eviction-test")
// This is a dummy context to wrap the outer AfterEach, which will run after the inner AfterEach. // This is a dummy context to wrap the outer AfterEach, which will run after the inner AfterEach.
// We want to list all of the node and pod events, including any that occur while waiting for // We want to list all of the node and pod events, including any that occur while waiting for
// memory pressure reduction, even if we time out while waiting. // memory pressure reduction, even if we time out while waiting.
Context("", func() { Context("", func() {
AfterEach(func() { AfterEach(func() {
// Print events
logNodeEvents(f) logNodeEvents(f)
logPodEvents(f) logPodEvents(f)
}) })
Context("", func() {
tempSetCurrentKubeletConfig(f, func(c *componentconfig.KubeletConfiguration) {
c.EvictionHard = evictionHard
})
Context("when there is memory pressure", func() { Context("when there is memory pressure", func() {
AfterEach(func() { AfterEach(func() {
@ -217,6 +228,7 @@ var _ = framework.KubeDescribe("MemoryEviction [Slow] [Serial] [Disruptive]", fu
}) })
}) })
}) })
})
}) })