Skip to content

Commit

Permalink
Fix faulty assumptions in summary API testing
Browse files Browse the repository at this point in the history
  • Loading branch information
derekwaynecarr committed Mar 20, 2017
1 parent 223c721 commit 5c8b957
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
6 changes: 5 additions & 1 deletion test/e2e_node/services/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,16 @@ func (e *E2EServices) startKubelet() (*server, error) {
// sense to test it that way
isSystemd = true
unitName := fmt.Sprintf("kubelet-%d.service", rand.Int31())
cmdArgs = append(cmdArgs, systemdRun, "--unit="+unitName, "--remain-after-exit", builder.GetKubeletServerBin())
cmdArgs = append(cmdArgs, systemdRun, "--unit="+unitName, "--slice=runtime.slice", "--remain-after-exit", builder.GetKubeletServerBin())
killCommand = exec.Command("systemctl", "kill", unitName)
restartCommand = exec.Command("systemctl", "restart", unitName)
e.logFiles["kubelet.log"] = logFileData{
journalctlCommand: []string{"-u", unitName},
}
cmdArgs = append(cmdArgs,
"--kubelet-cgroups=/kubelet.slice",
"--cgroup-root=/",
)
} else {
cmdArgs = append(cmdArgs, builder.GetKubeletServerBin())
cmdArgs = append(cmdArgs,
Expand Down
38 changes: 27 additions & 11 deletions test/e2e_node/summary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@ var _ = framework.KubeDescribe("Summary API", func() {
"AvailableBytes": BeNil(),
"UsageBytes": bounded(1*mb, 10*gb),
"WorkingSetBytes": bounded(1*mb, 10*gb),
"RSSBytes": bounded(1*mb, 1*gb),
// today, this returns the value reported
// in /sys/fs/cgroup/memory.stat for rss
// this value should really return /sys/fs/cgroup/memory.stat total_rss
// as we really want the hierarchical value not the usage local to / cgroup.
// for now, i am updating the bounding box to the value as coded, but the
// value reported needs to change.
// rss only makes sense if you are leaf cgroup
"RSSBytes": bounded(0, 1*gb),
"PageFaults": bounded(1000, 1E9),
"MajorPageFaults": bounded(0, 100000),
}),
Expand Down Expand Up @@ -131,7 +138,7 @@ var _ = framework.KubeDescribe("Summary API", func() {
"Time": recent(maxStatsAge),
"AvailableBytes": bounded(1*mb, 10*mb),
"UsageBytes": bounded(10*kb, 5*mb),
"WorkingSetBytes": bounded(10*kb, mb),
"WorkingSetBytes": bounded(10*kb, 2*mb),
"RSSBytes": bounded(1*kb, mb),
"PageFaults": bounded(100, 100000),
"MajorPageFaults": bounded(0, 10),
Expand Down Expand Up @@ -194,7 +201,14 @@ var _ = framework.KubeDescribe("Summary API", func() {
"AvailableBytes": bounded(100*mb, 100*gb),
"UsageBytes": bounded(10*mb, 10*gb),
"WorkingSetBytes": bounded(10*mb, 10*gb),
"RSSBytes": bounded(1*kb, 1*gb),
// today, this returns the value reported
// in /sys/fs/cgroup/memory.stat for rss
// this value should really return /sys/fs/cgroup/memory.stat total_rss
// as we really want the hierarchical value not the usage local to / cgroup.
// for now, i am updating the bounding box to the value as coded, but the
// value reported needs to change.
// rss only makes sense if you are leaf cgroup
"RSSBytes": bounded(0, 1*gb),
"PageFaults": bounded(1000, 1E9),
"MajorPageFaults": bounded(0, 100000),
}),
Expand All @@ -210,20 +224,22 @@ var _ = framework.KubeDescribe("Summary API", func() {
"Time": recent(maxStatsAge),
"AvailableBytes": fsCapacityBounds,
"CapacityBytes": fsCapacityBounds,
"UsedBytes": bounded(kb, 10*gb),
"InodesFree": bounded(1E4, 1E8),
"Inodes": bounded(1E4, 1E8),
"InodesUsed": bounded(0, 1E8),
// we assume we are not running tests on machines < 10tb of disk
"UsedBytes": bounded(kb, 10*tb),
"InodesFree": bounded(1E4, 1E8),
"Inodes": bounded(1E4, 1E8),
"InodesUsed": bounded(0, 1E8),
}),
"Runtime": ptrMatchAllFields(gstruct.Fields{
"ImageFs": ptrMatchAllFields(gstruct.Fields{
"Time": recent(maxStatsAge),
"AvailableBytes": fsCapacityBounds,
"CapacityBytes": fsCapacityBounds,
"UsedBytes": bounded(kb, 10*gb),
"InodesFree": bounded(1E4, 1E8),
"Inodes": bounded(1E4, 1E8),
"InodesUsed": bounded(0, 1E8),
// we assume we are not running tests on machines < 10tb of disk
"UsedBytes": bounded(kb, 10*tb),
"InodesFree": bounded(1E4, 1E8),
"Inodes": bounded(1E4, 1E8),
"InodesUsed": bounded(0, 1E8),
}),
}),
}),
Expand Down

0 comments on commit 5c8b957

Please sign in to comment.