From be8a07265546fda30bb3fbca8abca011c4af4485 Mon Sep 17 00:00:00 2001 From: SataQiu Date: Thu, 16 May 2019 23:31:47 +0800 Subject: [PATCH] fix golint failures of test/e2e --- hack/.golint_failures | 1 - test/e2e/examples.go | 22 +++++++++++----------- test/e2e/gke_local_ssd.go | 6 +++--- test/e2e/gke_node_pools.go | 6 +++--- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/hack/.golint_failures b/hack/.golint_failures index ec8a9441283..b2b652208a1 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -590,7 +590,6 @@ staging/src/k8s.io/sample-apiserver/pkg/apis/wardle staging/src/k8s.io/sample-apiserver/pkg/apis/wardle/v1alpha1 staging/src/k8s.io/sample-apiserver/pkg/registry/wardle/fischer staging/src/k8s.io/sample-apiserver/pkg/registry/wardle/flunder -test/e2e test/e2e/autoscaling test/e2e/chaosmonkey test/e2e/common diff --git a/test/e2e/examples.go b/test/e2e/examples.go index fa1a5a94ea5..f6ea9ee1be1 100644 --- a/test/e2e/examples.go +++ b/test/e2e/examples.go @@ -34,7 +34,7 @@ import ( e2elog "k8s.io/kubernetes/test/e2e/framework/log" "k8s.io/kubernetes/test/e2e/framework/testfiles" - . "github.com/onsi/ginkgo" + "github.com/onsi/ginkgo" ) const ( @@ -46,7 +46,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() { var c clientset.Interface var ns string - BeforeEach(func() { + ginkgo.BeforeEach(func() { c = f.ClientSet ns = f.Namespace.Name @@ -63,7 +63,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() { }) framework.KubeDescribe("Liveness", func() { - It("liveness pods should be automatically restarted", func() { + ginkgo.It("liveness pods should be automatically restarted", func() { test := "test/fixtures/doc-yaml/user-guide/liveness" execYaml := readFile(test, "exec-liveness.yaml.in") httpYaml := readFile(test, "http-liveness.yaml.in") @@ -94,7 +94,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() { wg.Done() } - By("Check restarts") + ginkgo.By("Check restarts") // Start the "actual test", and wait for both pods to complete. // If 2 fail: Something is broken with the test (or maybe even with liveness). @@ -111,7 +111,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() { }) framework.KubeDescribe("Secret", func() { - It("should create a pod that reads a secret", func() { + ginkgo.It("should create a pod that reads a secret", func() { test := "test/fixtures/doc-yaml/user-guide/secrets" secretYaml := readFile(test, "secret.yaml") podYaml := readFile(test, "secret-pod.yaml.in") @@ -119,31 +119,31 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() { nsFlag := fmt.Sprintf("--namespace=%v", ns) podName := "secret-test-pod" - By("creating secret and pod") + ginkgo.By("creating secret and pod") framework.RunKubectlOrDieInput(secretYaml, "create", "-f", "-", nsFlag) framework.RunKubectlOrDieInput(podYaml, "create", "-f", "-", nsFlag) err := framework.WaitForPodNoLongerRunningInNamespace(c, podName, ns) framework.ExpectNoError(err) - By("checking if secret was read correctly") + ginkgo.By("checking if secret was read correctly") _, err = framework.LookForStringInLog(ns, "secret-test-pod", "test-container", "value-1", serverStartTimeout) framework.ExpectNoError(err) }) }) framework.KubeDescribe("Downward API", func() { - It("should create a pod that prints his name and namespace", func() { + ginkgo.It("should create a pod that prints his name and namespace", func() { test := "test/fixtures/doc-yaml/user-guide/downward-api" podYaml := readFile(test, "dapi-pod.yaml.in") nsFlag := fmt.Sprintf("--namespace=%v", ns) podName := "dapi-test-pod" - By("creating the pod") + ginkgo.By("creating the pod") framework.RunKubectlOrDieInput(podYaml, "create", "-f", "-", nsFlag) err := framework.WaitForPodNoLongerRunningInNamespace(c, podName, ns) framework.ExpectNoError(err) - By("checking if name and namespace were passed correctly") + ginkgo.By("checking if name and namespace were passed correctly") _, err = framework.LookForStringInLog(ns, podName, "test-container", fmt.Sprintf("MY_POD_NAMESPACE=%v", ns), serverStartTimeout) framework.ExpectNoError(err) _, err = framework.LookForStringInLog(ns, podName, "test-container", fmt.Sprintf("MY_POD_NAME=%v", podName), serverStartTimeout) @@ -154,5 +154,5 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() { func readFile(test, file string) string { from := filepath.Join(test, file) - return commonutils.SubstituteImageName(string(testfiles.ReadOrDie(from, Fail))) + return commonutils.SubstituteImageName(string(testfiles.ReadOrDie(from, ginkgo.Fail))) } diff --git a/test/e2e/gke_local_ssd.go b/test/e2e/gke_local_ssd.go index b51f9bd9ac2..e1d4d1ce2bd 100644 --- a/test/e2e/gke_local_ssd.go +++ b/test/e2e/gke_local_ssd.go @@ -26,18 +26,18 @@ import ( "k8s.io/kubernetes/test/e2e/framework" e2elog "k8s.io/kubernetes/test/e2e/framework/log" - . "github.com/onsi/ginkgo" + "github.com/onsi/ginkgo" ) var _ = framework.KubeDescribe("GKE local SSD [Feature:GKELocalSSD]", func() { f := framework.NewDefaultFramework("localssd") - BeforeEach(func() { + ginkgo.BeforeEach(func() { framework.SkipUnlessProviderIs("gke") }) - It("should write and read from node local SSD [Feature:GKELocalSSD]", func() { + ginkgo.It("should write and read from node local SSD [Feature:GKELocalSSD]", func() { e2elog.Logf("Start local SSD test") createNodePoolWithLocalSsds("np-ssd") doTestWriteAndReadToLocalSsd(f) diff --git a/test/e2e/gke_node_pools.go b/test/e2e/gke_node_pools.go index 784f5e06887..4eb1173d135 100644 --- a/test/e2e/gke_node_pools.go +++ b/test/e2e/gke_node_pools.go @@ -23,18 +23,18 @@ import ( "k8s.io/kubernetes/test/e2e/framework" e2elog "k8s.io/kubernetes/test/e2e/framework/log" - . "github.com/onsi/ginkgo" + "github.com/onsi/ginkgo" ) var _ = framework.KubeDescribe("GKE node pools [Feature:GKENodePool]", func() { f := framework.NewDefaultFramework("node-pools") - BeforeEach(func() { + ginkgo.BeforeEach(func() { framework.SkipUnlessProviderIs("gke") }) - It("should create a cluster with multiple node pools [Feature:GKENodePool]", func() { + ginkgo.It("should create a cluster with multiple node pools [Feature:GKENodePool]", func() { e2elog.Logf("Start create node pool test") testCreateDeleteNodePool(f, "test-pool") })