mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-11-04 07:49:35 +00:00 
			
		
		
		
	fix golint failures of test/e2e
This commit is contained in:
		@@ -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)))
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user