Merge pull request #77980 from SataQiu/fix-golint-test-20190516

Fix golint failures of test/e2e
k3s-v1.15.3
Kubernetes Prow Robot 2019-05-17 07:01:04 -07:00 committed by GitHub
commit 46a80259f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 18 deletions

View File

@ -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

View File

@ -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)))
}

View File

@ -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)

View File

@ -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")
})