Merge pull request #55984 from derekwaynecarr/summary-tests

Automatic merge from submit-queue (batch tested with PRs 55954, 56037, 55866, 55984, 54994). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

kubelet summary api test updates

**What this PR does / why we need it**
Fixes https://github.com/kubernetes/kubernetes/issues/55985
Improve the accuracy of the test as follows:
- ensure memory bound checks for unconstrained group are limited by actual node capacity
- grow the fs capacity bounds so we can run on larger drives (i.e. my dev laptop)

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2017-12-13 23:25:59 -08:00 committed by GitHub
commit 6c5eb50c8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,7 +75,11 @@ var _ = framework.KubeDescribe("Summary API", func() {
maxStartAge = time.Hour * 24 * 365 // 1 year maxStartAge = time.Hour * 24 * 365 // 1 year
maxStatsAge = time.Minute maxStatsAge = time.Minute
) )
fsCapacityBounds := bounded(100*framework.Mb, 100*framework.Gb) // fetch node so we can know proper node memory bounds for unconstrained cgroups
node := getLocalNode(f)
memoryCapacity := node.Status.Capacity["memory"]
memoryLimit := memoryCapacity.Value()
fsCapacityBounds := bounded(100*framework.Mb, 10*framework.Tb)
// Expectations for system containers. // Expectations for system containers.
sysContExpectations := func() types.GomegaMatcher { sysContExpectations := func() types.GomegaMatcher {
return gstruct.MatchAllFields(gstruct.Fields{ return gstruct.MatchAllFields(gstruct.Fields{
@ -90,10 +94,10 @@ var _ = framework.KubeDescribe("Summary API", func() {
"Time": recent(maxStatsAge), "Time": recent(maxStatsAge),
// We don't limit system container memory. // We don't limit system container memory.
"AvailableBytes": BeNil(), "AvailableBytes": BeNil(),
"UsageBytes": bounded(1*framework.Mb, 10*framework.Gb), "UsageBytes": bounded(1*framework.Mb, memoryLimit),
"WorkingSetBytes": bounded(1*framework.Mb, 10*framework.Gb), "WorkingSetBytes": bounded(1*framework.Mb, memoryLimit),
// this now returns /sys/fs/cgroup/memory.stat total_rss // this now returns /sys/fs/cgroup/memory.stat total_rss
"RSSBytes": bounded(1*framework.Mb, 1*framework.Gb), "RSSBytes": bounded(1*framework.Mb, memoryLimit),
"PageFaults": bounded(1000, 1E9), "PageFaults": bounded(1000, 1E9),
"MajorPageFaults": bounded(0, 100000), "MajorPageFaults": bounded(0, 100000),
}), }),
@ -116,9 +120,9 @@ var _ = framework.KubeDescribe("Summary API", func() {
"Time": recent(maxStatsAge), "Time": recent(maxStatsAge),
// We don't limit system container memory. // We don't limit system container memory.
"AvailableBytes": BeNil(), "AvailableBytes": BeNil(),
"UsageBytes": bounded(100*framework.Kb, 10*framework.Gb), "UsageBytes": bounded(100*framework.Kb, memoryLimit),
"WorkingSetBytes": bounded(100*framework.Kb, 10*framework.Gb), "WorkingSetBytes": bounded(100*framework.Kb, memoryLimit),
"RSSBytes": bounded(100*framework.Kb, 1*framework.Gb), "RSSBytes": bounded(100*framework.Kb, memoryLimit),
"PageFaults": bounded(1000, 1E9), "PageFaults": bounded(1000, 1E9),
"MajorPageFaults": bounded(0, 100000), "MajorPageFaults": bounded(0, 100000),
}) })
@ -231,11 +235,11 @@ var _ = framework.KubeDescribe("Summary API", func() {
}), }),
"Memory": ptrMatchAllFields(gstruct.Fields{ "Memory": ptrMatchAllFields(gstruct.Fields{
"Time": recent(maxStatsAge), "Time": recent(maxStatsAge),
"AvailableBytes": bounded(100*framework.Mb, 100*framework.Gb), "AvailableBytes": bounded(100*framework.Mb, memoryLimit),
"UsageBytes": bounded(10*framework.Mb, 10*framework.Gb), "UsageBytes": bounded(10*framework.Mb, memoryLimit),
"WorkingSetBytes": bounded(10*framework.Mb, 10*framework.Gb), "WorkingSetBytes": bounded(10*framework.Mb, memoryLimit),
// this now returns /sys/fs/cgroup/memory.stat total_rss // this now returns /sys/fs/cgroup/memory.stat total_rss
"RSSBytes": bounded(1*framework.Kb, 1*framework.Gb), "RSSBytes": bounded(1*framework.Kb, memoryLimit),
"PageFaults": bounded(1000, 1E9), "PageFaults": bounded(1000, 1E9),
"MajorPageFaults": bounded(0, 100000), "MajorPageFaults": bounded(0, 100000),
}), }),