From 124efde4f8c055c6295c5fbb88b63e98d5270f62 Mon Sep 17 00:00:00 2001 From: danielqsj Date: Fri, 10 May 2019 12:37:01 +0800 Subject: [PATCH] fix golint error in e2e/node --- hack/.golint_failures | 1 - test/e2e/node/events.go | 8 ++++---- test/e2e/node/framework.go | 1 + test/e2e/node/node_problem_detector.go | 6 +++--- test/e2e/node/pre_stop.go | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hack/.golint_failures b/hack/.golint_failures index 064c109f162..c1a9aa1179d 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -606,7 +606,6 @@ test/e2e/chaosmonkey test/e2e/common test/e2e/framework test/e2e/lifecycle/bootstrap -test/e2e/node test/e2e/scalability test/e2e/scheduling test/e2e/storage/drivers diff --git a/test/e2e/node/events.go b/test/e2e/node/events.go index ce611148595..aa7841bf48e 100644 --- a/test/e2e/node/events.go +++ b/test/e2e/node/events.go @@ -85,18 +85,18 @@ var _ = SIGDescribe("Events", func() { gomega.Expect(len(pods.Items)).To(gomega.Equal(1)) ginkgo.By("retrieving the pod") - podWithUid, err := podClient.Get(pod.Name, metav1.GetOptions{}) + podWithUID, err := podClient.Get(pod.Name, metav1.GetOptions{}) if err != nil { framework.Failf("Failed to get pod: %v", err) } - e2elog.Logf("%+v\n", podWithUid) + e2elog.Logf("%+v\n", podWithUID) var events *v1.EventList // Check for scheduler event about the pod. ginkgo.By("checking for scheduler event about the pod") framework.ExpectNoError(wait.Poll(time.Second*2, time.Second*60, func() (bool, error) { selector := fields.Set{ "involvedObject.kind": "Pod", - "involvedObject.uid": string(podWithUid.UID), + "involvedObject.uid": string(podWithUID.UID), "involvedObject.namespace": f.Namespace.Name, "source": v1.DefaultSchedulerName, }.AsSelector().String() @@ -115,7 +115,7 @@ var _ = SIGDescribe("Events", func() { ginkgo.By("checking for kubelet event about the pod") framework.ExpectNoError(wait.Poll(time.Second*2, time.Second*60, func() (bool, error) { selector := fields.Set{ - "involvedObject.uid": string(podWithUid.UID), + "involvedObject.uid": string(podWithUID.UID), "involvedObject.kind": "Pod", "involvedObject.namespace": f.Namespace.Name, "source": "kubelet", diff --git a/test/e2e/node/framework.go b/test/e2e/node/framework.go index a206bef7008..e6ca8cd1f2d 100644 --- a/test/e2e/node/framework.go +++ b/test/e2e/node/framework.go @@ -18,6 +18,7 @@ package node import "k8s.io/kubernetes/test/e2e/framework" +// SIGDescribe annotates the test with the SIG label. func SIGDescribe(text string, body func()) bool { return framework.KubeDescribe("[sig-node] "+text, body) } diff --git a/test/e2e/node/node_problem_detector.go b/test/e2e/node/node_problem_detector.go index 1c27a231b1e..c9f4c4ae3ed 100644 --- a/test/e2e/node/node_problem_detector.go +++ b/test/e2e/node/node_problem_detector.go @@ -102,7 +102,7 @@ var _ = SIGDescribe("NodeProblemDetector [DisabledForLargeClusters]", func() { gomega.Expect(result.Stdout).NotTo(gomega.ContainSubstring("node-problem-detector.service: Failed")) if isStandaloneMode[host] { - cpuUsage, uptime := getCpuStat(f, host) + cpuUsage, uptime := getCPUStat(f, host) cpuUsageStats[host] = append(cpuUsageStats[host], cpuUsage) uptimeStats[host] = append(uptimeStats[host], uptime) } @@ -138,7 +138,7 @@ var _ = SIGDescribe("NodeProblemDetector [DisabledForLargeClusters]", func() { rssStats[host] = append(rssStats[host], rss) workingSetStats[host] = append(workingSetStats[host], workingSet) if i == numIterations { - cpuUsage, uptime := getCpuStat(f, host) + cpuUsage, uptime := getCPUStat(f, host) cpuUsageStats[host] = append(cpuUsageStats[host], cpuUsage) uptimeStats[host] = append(uptimeStats[host], uptime) } @@ -249,7 +249,7 @@ func getMemoryStat(f *framework.Framework, host string) (rss, workingSet float64 return } -func getCpuStat(f *framework.Framework, host string) (usage, uptime float64) { +func getCPUStat(f *framework.Framework, host string) (usage, uptime float64) { cpuCmd := "cat /sys/fs/cgroup/cpu/system.slice/node-problem-detector.service/cpuacct.usage && cat /proc/uptime | awk '{print $1}'" result, err := e2essh.SSH(cpuCmd, host, framework.TestContext.Provider) framework.ExpectNoError(err) diff --git a/test/e2e/node/pre_stop.go b/test/e2e/node/pre_stop.go index 20b8cd59b9a..f03a621727e 100644 --- a/test/e2e/node/pre_stop.go +++ b/test/e2e/node/pre_stop.go @@ -36,7 +36,7 @@ import ( "github.com/onsi/gomega" ) -// partially cloned from webserver.go +// State partially cloned from webserver.go type State struct { Received map[string]int }