Verify misc container in summary test

pull/6/head
Tim St. Clair 2016-12-01 14:02:39 -08:00
parent 737edd02a4
commit bcf5e434fa
No known key found for this signature in database
GPG Key ID: 434D16BCEF479EAB
2 changed files with 14 additions and 6 deletions

View File

@ -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",

View File

@ -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),