Skip to content

Commit

Permalink
Merge pull request kubernetes#43248 from yujuhong/pause_proc
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

node e2e: improve the validate OOM score test for infra containers

The test blindly checked all "pause" processes on the node, assuming
they were all infra containers. This change takes a snapshot of all
existing "pause" processes on the node, and exclude them in the
validation. The test still relies on the fact that it runs exclusively
on the node. If that assumption changes, we will need other methods to
locate the PIDs of the infra containers.

This fixes kubernetes#37580
  • Loading branch information
Kubernetes Submit Queue authored Apr 4, 2017
2 parents ff40d8b + 056e343 commit 0a13851
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/e2e_node/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ go_test(
"//vendor:k8s.io/apimachinery/pkg/runtime/schema",
"//vendor:k8s.io/apimachinery/pkg/types",
"//vendor:k8s.io/apimachinery/pkg/util/intstr",
"//vendor:k8s.io/apimachinery/pkg/util/sets",
"//vendor:k8s.io/apimachinery/pkg/util/uuid",
"//vendor:k8s.io/apimachinery/pkg/watch",
"//vendor:k8s.io/client-go/pkg/api",
Expand Down
13 changes: 12 additions & 1 deletion test/e2e_node/container_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (

"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/test/e2e/framework"
Expand Down Expand Up @@ -93,7 +94,13 @@ var _ = framework.KubeDescribe("Container Manager Misc [Serial]", func() {
})
Context("", func() {
It("pod infra containers oom-score-adj should be -998 and best effort container's should be 1000", func() {
var err error
// Take a snapshot of existing pause processes. These were
// created before this test, and may not be infra
// containers. They should be excluded from the test.
existingPausePIDs, err := getPidsForProcess("pause", "")
Expect(err).To(BeNil(), "failed to list all pause processes on the node")
existingPausePIDSet := sets.NewInt(existingPausePIDs...)

podClient := f.PodClient()
podName := "besteffort" + string(uuid.NewUUID())
podClient.Create(&v1.Pod{
Expand All @@ -117,6 +124,10 @@ var _ = framework.KubeDescribe("Container Manager Misc [Serial]", func() {
return fmt.Errorf("failed to get list of pause pids: %v", err)
}
for _, pid := range pausePids {
if existingPausePIDSet.Has(pid) {
// Not created by this test. Ignore it.
continue
}
if err := validateOOMScoreAdjSetting(pid, -998); err != nil {
return err
}
Expand Down

0 comments on commit 0a13851

Please sign in to comment.