diff --git a/test/e2e/windows/cpu_limits.go b/test/e2e/windows/cpu_limits.go index bcc7818a7e7..18fcfc7e5bd 100644 --- a/test/e2e/windows/cpu_limits.go +++ b/test/e2e/windows/cpu_limits.go @@ -82,10 +82,16 @@ var _ = SIGDescribe("[Feature:Windows] Cpu Resources [Serial]", func() { found = true break } - framework.ExpectEqual(found, true, "Found pod in stats summary") + if !found { + framework.Failf("Pod %s/%s not found in the stats summary %+v", p.Namespace, p.Name, allPods) + } framework.Logf("Pod %s usage: %v", p.Name, cpuUsage) - framework.ExpectEqual(cpuUsage > 0, true, "Pods reported usage should be > 0") - framework.ExpectEqual((.5*1.05) > cpuUsage, true, "Pods reported usage should not exceed limit by >5%") + if cpuUsage <= 0 { + framework.Failf("Pod %s/%s reported usage is %v, but it should be greater than 0", p.Namespace, p.Name, cpuUsage) + } + if cpuUsage >= .5*1.05 { + framework.Failf("Pod %s/%s reported usage is %v, but it should not exceed limit by > 5%%", p.Namespace, p.Name, cpuUsage) + } } }) }) diff --git a/test/e2e/windows/kubelet_stats.go b/test/e2e/windows/kubelet_stats.go index 6e614db17b6..493d59f1ba8 100644 --- a/test/e2e/windows/kubelet_stats.go +++ b/test/e2e/windows/kubelet_stats.go @@ -77,17 +77,20 @@ var _ = SIGDescribe("[Feature:Windows] Kubelet-Stats [Serial]", func() { } statsChecked = statsChecked + 1 - framework.ExpectEqual(*podStats.CPU.UsageCoreNanoSeconds > 0, true, "Pod stats should not report 0 cpu usage") - framework.ExpectEqual(*podStats.Memory.WorkingSetBytes > 0, true, "Pod stats should not report 0 bytes for memory working set ") - - framework.ExpectEqual(podStats.Network != nil, true, "Pod stats should report network stats") - framework.ExpectEqual(podStats.Network.Name != "", true, "Pod stats should report network name") - framework.ExpectEqual(*podStats.Network.TxBytes > 0, true, "Pod stats should report network Tx stats") - framework.ExpectEqual(len(podStats.Network.Interfaces) > 0, true, "Pod Stats should report individual interfaces stats") + if *podStats.CPU.UsageCoreNanoSeconds <= 0 { + framework.Failf("Pod %s/%s stats report cpu usage equal to %v but it should be greater than 0", podStats.PodRef.Namespace, podStats.PodRef.Name, *podStats.CPU.UsageCoreNanoSeconds) + } + if *podStats.Memory.WorkingSetBytes <= 0 { + framework.Failf("Pod %s/%s stats report bytes for memory working set equal to %v but it should be greater than 0", podStats.PodRef.Namespace, podStats.PodRef.Name, *podStats.Memory.WorkingSetBytes) + } for _, containerStats := range podStats.Containers { - framework.ExpectEqual(containerStats.Logs != nil, true, "Pod stats should have container log stats") - framework.ExpectEqual(*containerStats.Logs.AvailableBytes > 0, true, "container log stats should not report 0 bytes for AvailableBytes") + if containerStats.Logs == nil { + framework.Failf("Pod %s/%s stats should have container log stats, but it is nil", podStats.PodRef.Namespace, podStats.PodRef.Name) + } + if *containerStats.Logs.AvailableBytes <= 0 { + framework.Failf("Pod %s/%s container log stats report %v bytes for AvailableBytes, but it should be greater than 0", podStats.PodRef.Namespace, podStats.PodRef.Name, *containerStats.Logs.AvailableBytes) + } } } framework.ExpectEqual(statsChecked, 10, "Should find stats for 10 pods in kubelet stats") @@ -99,7 +102,9 @@ var _ = SIGDescribe("[Feature:Windows] Kubelet-Stats [Serial]", func() { durationMatch := avgDurationMs <= time.Duration(10*time.Second).Milliseconds() framework.Logf("Getting kubelet stats for node %v took an average of %v milliseconds over %v iterations", targetNode.Name, avgDurationMs, iterations) - framework.ExpectEqual(durationMatch, true, "Collecting kubelet stats should not take longer than 10 seconds") + if !durationMatch { + framework.Failf("Collecting kubelet stats took %v seconds but it should not take longer than 10 seconds", durationMatch) + } }) }) }) @@ -146,12 +151,20 @@ var _ = SIGDescribe("[Feature:Windows] Kubelet-Stats", func() { } statsChecked = statsChecked + 1 - framework.ExpectEqual(*podStats.CPU.UsageCoreNanoSeconds > 0, true, "Pod stats should not report 0 cpu usage") - framework.ExpectEqual(*podStats.Memory.WorkingSetBytes > 0, true, "Pod stats should not report 0 bytes for memory working set ") + if *podStats.CPU.UsageCoreNanoSeconds <= 0 { + framework.Failf("Pod %s/%s stats report cpu usage equal to %v but it should be greater than 0", podStats.PodRef.Namespace, podStats.PodRef.Name, *podStats.CPU.UsageCoreNanoSeconds) + } + if *podStats.Memory.WorkingSetBytes <= 0 { + framework.Failf("Pod %s/%s stats report bytes for memory working set equal to %v but it should be greater than 0", podStats.PodRef.Namespace, podStats.PodRef.Name, *podStats.Memory.WorkingSetBytes) + } for _, containerStats := range podStats.Containers { - framework.ExpectEqual(containerStats.Logs != nil, true, "Pod stats should have container log stats") - framework.ExpectEqual(*containerStats.Logs.AvailableBytes > 0, true, "container log stats should not report 0 bytes for AvailableBytes") + if containerStats.Logs == nil { + framework.Failf("Pod %s/%s stats should have container log stats, but it is nil", podStats.PodRef.Namespace, podStats.PodRef.Name) + } + if *containerStats.Logs.AvailableBytes <= 0 { + framework.Failf("Pod %s/%s container log stats report %v bytes for AvailableBytes, but it should be greater than 0", podStats.PodRef.Namespace, podStats.PodRef.Name, *containerStats.Logs.AvailableBytes) + } } } framework.ExpectEqual(statsChecked, 3, "Should find stats for 10 pods in kubelet stats") @@ -163,7 +176,9 @@ var _ = SIGDescribe("[Feature:Windows] Kubelet-Stats", func() { durationMatch := avgDurationMs <= time.Duration(10*time.Second).Milliseconds() framework.Logf("Getting kubelet stats for node %v took an average of %v milliseconds over %v iterations", targetNode.Name, avgDurationMs, iterations) - framework.ExpectEqual(durationMatch, true, "Collecting kubelet stats should not take longer than 10 seconds") + if !durationMatch { + framework.Failf("Collecting kubelet stats took %v seconds but it should not take longer than 10 seconds", durationMatch) + } }) }) })