From bcf5e434fa5dfa3e51499aafd1e0134c86a3dd6c Mon Sep 17 00:00:00 2001 From: "Tim St. Clair" Date: Thu, 1 Dec 2016 14:02:39 -0800 Subject: [PATCH] Verify misc container in summary test --- test/e2e_node/BUILD | 1 + test/e2e_node/summary_test.go | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/test/e2e_node/BUILD b/test/e2e_node/BUILD index 964c4a4a0f6..f21a6592692 100644 --- a/test/e2e_node/BUILD +++ b/test/e2e_node/BUILD @@ -103,6 +103,7 @@ go_test( "//test/e2e_node/services:go_default_library", "//test/e2e_node/system:go_default_library", "//test/utils:go_default_library", + "//vendor:github.com/coreos/go-systemd/util", "//vendor:github.com/davecgh/go-spew/spew", "//vendor:github.com/golang/glog", "//vendor:github.com/kardianos/osext", diff --git a/test/e2e_node/summary_test.go b/test/e2e_node/summary_test.go index 446ab09ad0b..c4d328fca48 100644 --- a/test/e2e_node/summary_test.go +++ b/test/e2e_node/summary_test.go @@ -26,6 +26,7 @@ import ( "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/stats" "k8s.io/kubernetes/test/e2e/framework" + systemdutil "github.com/coreos/go-systemd/util" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/gstruct" @@ -83,6 +84,15 @@ var _ = framework.KubeDescribe("Summary API", func() { "Logs": BeNil(), "UserDefinedMetrics": BeEmpty(), }) + systemContainers := gstruct.Elements{ + "kubelet": sysContExpectations, + "runtime": sysContExpectations, + } + // The Kubelet only manages the 'misc' system container if the host is not running systemd. + if !systemdutil.IsRunningSystemd() { + framework.Logf("Host not running systemd; expecting 'misc' system container.") + systemContainers["misc"] = sysContExpectations + } // Expectations for pods. podExpectations := gstruct.MatchAllFields(gstruct.Fields{ "PodRef": gstruct.Ignore(), @@ -147,12 +157,9 @@ var _ = framework.KubeDescribe("Summary API", func() { }) matchExpectations := ptrMatchAllFields(gstruct.Fields{ "Node": gstruct.MatchAllFields(gstruct.Fields{ - "NodeName": Equal(framework.TestContext.NodeName), - "StartTime": recent(maxStartAge), - "SystemContainers": gstruct.MatchElements(summaryObjectID, gstruct.IgnoreExtras, gstruct.Elements{ - "kubelet": sysContExpectations, - "runtime": sysContExpectations, - }), + "NodeName": Equal(framework.TestContext.NodeName), + "StartTime": recent(maxStartAge), + "SystemContainers": gstruct.MatchAllElements(summaryObjectID, systemContainers), "CPU": ptrMatchAllFields(gstruct.Fields{ "Time": recent(maxStatsAge), "UsageNanoCores": bounded(100E3, 2E9),