Set custom threshold for memory eviction test

This commit is contained in:
Michael Taufen
2016-11-15 09:54:12 -08:00
parent ab794c6128
commit 945d223738
2 changed files with 177 additions and 164 deletions

View File

@@ -77,6 +77,7 @@ go_test(
], ],
deps = [ deps = [
"//pkg/api/v1:go_default_library", "//pkg/api/v1:go_default_library",
"//pkg/apis/componentconfig:go_default_library",
"//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/clientset_generated/clientset:go_default_library",
"//pkg/kubelet:go_default_library", "//pkg/kubelet:go_default_library",
"//pkg/kubelet/api/v1alpha1/stats:go_default_library", "//pkg/kubelet/api/v1alpha1/stats:go_default_library",

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
}) })
}) })
}) })
})
}) })