From 2d6ee874a5bddd6624fe7f827720e25e074580b3 Mon Sep 17 00:00:00 2001 From: yanxuean Date: Wed, 15 Aug 2018 17:00:12 +0800 Subject: [PATCH 1/2] should check all error Signed-off-by: yanxuean --- test/e2e_node/resource_collector.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e_node/resource_collector.go b/test/e2e_node/resource_collector.go index 94987bc883..68d4778db3 100644 --- a/test/e2e_node/resource_collector.go +++ b/test/e2e_node/resource_collector.go @@ -86,9 +86,9 @@ func NewResourceCollector(interval time.Duration) *ResourceCollector { // then repeatedly runs collectStats. func (r *ResourceCollector) Start() { // Get the cgroup container names for kubelet and runtime - kubeletContainer, err := getContainerNameForProcess(kubeletProcessName, "") - runtimeContainer, err := getContainerNameForProcess(framework.TestContext.ContainerRuntimeProcessName, framework.TestContext.ContainerRuntimePidFile) - if err == nil { + kubeletContainer, err1 := getContainerNameForProcess(kubeletProcessName, "") + runtimeContainer, err2 := getContainerNameForProcess(framework.TestContext.ContainerRuntimeProcessName, framework.TestContext.ContainerRuntimePidFile) + if err1 == nil && err2 == nil { systemContainers = map[string]string{ stats.SystemContainerKubelet: kubeletContainer, stats.SystemContainerRuntime: runtimeContainer, From ea9376a18b1a47bbc51e742e9c6f1c5e94def34e Mon Sep 17 00:00:00 2001 From: yanxuean Date: Wed, 15 Aug 2018 17:09:45 +0800 Subject: [PATCH 2/2] redundant equal compare Signed-off-by: yanxuean --- test/e2e_node/resource_collector.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/e2e_node/resource_collector.go b/test/e2e_node/resource_collector.go index 68d4778db3..97b51edef1 100644 --- a/test/e2e_node/resource_collector.go +++ b/test/e2e_node/resource_collector.go @@ -165,9 +165,6 @@ func (r *ResourceCollector) collectStats(oldStatsMap map[string]*cadvisorapiv2.C newStats := cStats.Stats[0] if oldStats, ok := oldStatsMap[name]; ok && oldStats.Timestamp.Before(newStats.Timestamp) { - if oldStats.Timestamp.Equal(newStats.Timestamp) { - continue - } r.buffers[name] = append(r.buffers[name], computeContainerResourceUsage(name, oldStats, newStats)) } oldStatsMap[name] = newStats