Skip to content

Commit

Permalink
Tweak constants in monitor_resources test
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarek committed Dec 8, 2015
1 parent f4d3f06 commit 217149c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion test/e2e/kubelet_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ type containerResourceUsage struct {
}

func (r *containerResourceUsage) isStrictlyGreaterThan(rhs *containerResourceUsage) bool {
return r.CPUUsageInCores > rhs.CPUUsageInCores && r.MemoryUsageInBytes > rhs.MemoryUsageInBytes && r.MemoryWorkingSetInBytes > rhs.MemoryWorkingSetInBytes
return r.CPUUsageInCores > rhs.CPUUsageInCores && r.MemoryWorkingSetInBytes > rhs.MemoryWorkingSetInBytes
}

type resourceUsagePerContainer map[string]*containerResourceUsage
Expand Down
16 changes: 4 additions & 12 deletions test/e2e/monitor_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,17 @@ var systemContainers = []string{"/docker-daemon", "/kubelet", "/system"}

var allowedUsage = resourceUsagePerContainer{
"/docker-daemon": &containerResourceUsage{
CPUUsageInCores: 0.08,
MemoryUsageInBytes: 4500000000,
CPUUsageInCores: 0.1,
MemoryWorkingSetInBytes: 1500000000,
},
// TODO: Make Kubelet constraints sane again when #17774 is fixed.
"/kubelet": &containerResourceUsage{
CPUUsageInCores: 0.1,
MemoryUsageInBytes: 1000000000,
MemoryWorkingSetInBytes: 250000000,
MemoryWorkingSetInBytes: 300000000,
},
"/system": &containerResourceUsage{
CPUUsageInCores: 0.03,
MemoryUsageInBytes: 100000000,
MemoryWorkingSetInBytes: 100000000,
CPUUsageInCores: 0.05,
MemoryWorkingSetInBytes: 700000000,
},
}

Expand All @@ -58,7 +55,6 @@ func computeAverage(sliceOfUsages []resourceUsagePerContainer) (result resourceU
for _, container := range systemContainers {
singleResult := &containerResourceUsage{
CPUUsageInCores: result[container].CPUUsageInCores + usage[container].CPUUsageInCores,
MemoryUsageInBytes: result[container].MemoryUsageInBytes + usage[container].MemoryUsageInBytes,
MemoryWorkingSetInBytes: result[container].MemoryWorkingSetInBytes + usage[container].MemoryWorkingSetInBytes,
}
result[container] = singleResult
Expand All @@ -67,7 +63,6 @@ func computeAverage(sliceOfUsages []resourceUsagePerContainer) (result resourceU
for _, container := range systemContainers {
singleResult := &containerResourceUsage{
CPUUsageInCores: result[container].CPUUsageInCores / float64(len(sliceOfUsages)),
MemoryUsageInBytes: result[container].MemoryUsageInBytes / int64(len(sliceOfUsages)),
MemoryWorkingSetInBytes: result[container].MemoryWorkingSetInBytes / int64(len(sliceOfUsages)),
}
result[container] = singleResult
Expand Down Expand Up @@ -123,9 +118,6 @@ var _ = Describe("Resource usage of system containers", func() {
if allowedUsage[container].CPUUsageInCores < cUsage.CPUUsageInCores {
Logf("CPU is too high for %s (%v)", container, cUsage.CPUUsageInCores)
}
if allowedUsage[container].MemoryUsageInBytes < cUsage.MemoryUsageInBytes {
Logf("Memory use is too high for %s (%v)", container, cUsage.MemoryUsageInBytes)
}
if allowedUsage[container].MemoryWorkingSetInBytes < cUsage.MemoryWorkingSetInBytes {
Logf("Working set is too high for %s (%v)", container, cUsage.MemoryWorkingSetInBytes)
}
Expand Down

0 comments on commit 217149c

Please sign in to comment.