diff --git a/hack/.staticcheck_failures b/hack/.staticcheck_failures index a1cbbb2b6dd..62a533eec92 100644 --- a/hack/.staticcheck_failures +++ b/hack/.staticcheck_failures @@ -76,7 +76,6 @@ test/e2e/apimachinery test/e2e/apps test/e2e/auth test/e2e/autoscaling -test/e2e/common test/e2e/instrumentation/logging/stackdriver test/e2e/instrumentation/monitoring test/e2e/manifest diff --git a/test/e2e/common/autoscaling_utils.go b/test/e2e/common/autoscaling_utils.go index 57c5b98a32d..2cfbd1dfc29 100644 --- a/test/e2e/common/autoscaling_utils.go +++ b/test/e2e/common/autoscaling_utils.go @@ -70,7 +70,6 @@ var ( KindRC = schema.GroupVersionKind{Version: "v1", Kind: "ReplicationController"} KindDeployment = schema.GroupVersionKind{Group: "apps", Version: "v1beta2", Kind: "Deployment"} KindReplicaSet = schema.GroupVersionKind{Group: "apps", Version: "v1beta2", Kind: "ReplicaSet"} - subresource = "scale" ) /* @@ -472,7 +471,6 @@ func runServiceAndWorkloadForResourceConsumer(c clientset.Interface, ns, name st switch kind { case KindRC: framework.ExpectNoError(framework.RunRC(rcConfig)) - break case KindDeployment: dpConfig := testutils.DeploymentConfig{ RCConfig: rcConfig, @@ -481,14 +479,12 @@ func runServiceAndWorkloadForResourceConsumer(c clientset.Interface, ns, name st dpConfig.NodeDumpFunc = framework.DumpNodeDebugInfo dpConfig.ContainerDumpFunc = framework.LogFailedContainers framework.ExpectNoError(testutils.RunDeployment(dpConfig)) - break case KindReplicaSet: rsConfig := testutils.ReplicaSetConfig{ RCConfig: rcConfig, } ginkgo.By(fmt.Sprintf("creating replicaset %s in namespace %s", rsConfig.Name, rsConfig.Namespace)) framework.ExpectNoError(replicaset.RunReplicaSet(rsConfig)) - break default: framework.Failf(invalidKind) } diff --git a/test/e2e/common/container.go b/test/e2e/common/container.go index 2864a24687e..d00037eafc6 100644 --- a/test/e2e/common/container.go +++ b/test/e2e/common/container.go @@ -20,7 +20,7 @@ import ( "fmt" "time" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/uuid" diff --git a/test/e2e/common/container_probe.go b/test/e2e/common/container_probe.go index b37e07ba36b..8b7e6050ce3 100644 --- a/test/e2e/common/container_probe.go +++ b/test/e2e/common/container_probe.go @@ -104,7 +104,7 @@ var _ = framework.KubeDescribe("Probing container", func() { p, err := podClient.Get(p.Name, metav1.GetOptions{}) framework.ExpectNoError(err) - isReady, err := testutils.PodRunningReady(p) + isReady, _ := testutils.PodRunningReady(p) gomega.Expect(isReady).NotTo(gomega.BeTrue(), "pod should be not ready") restartCount := getRestartCount(p) @@ -269,7 +269,7 @@ func GetContainerStartedTime(p *v1.Pod, containerName string) (time.Time, error) continue } if status.State.Running == nil { - return time.Time{}, fmt.Errorf("Container is not running") + return time.Time{}, fmt.Errorf("container is not running") } return status.State.Running.StartedAt.Time, nil } @@ -282,7 +282,7 @@ func GetTransitionTimeForReadyCondition(p *v1.Pod) (time.Time, error) { return cond.LastTransitionTime.Time, nil } } - return time.Time{}, fmt.Errorf("No ready condition can be found for pod") + return time.Time{}, fmt.Errorf("no ready condition can be found for pod") } func getRestartCount(p *v1.Pod) int { diff --git a/test/e2e/common/expansion.go b/test/e2e/common/expansion.go index 5116a6b97cd..2c03a9b2ad8 100644 --- a/test/e2e/common/expansion.go +++ b/test/e2e/common/expansion.go @@ -377,8 +377,7 @@ var _ = framework.KubeDescribe("Variable Expansion", func() { } ginkgo.By("creating the pod with failed condition") - var podClient *framework.PodClient - podClient = f.PodClient() + var podClient *framework.PodClient = f.PodClient() pod = podClient.Create(pod) err := e2epod.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, framework.PodStartShortTimeout) @@ -469,8 +468,7 @@ var _ = framework.KubeDescribe("Variable Expansion", func() { } ginkgo.By("creating the pod") - var podClient *framework.PodClient - podClient = f.PodClient() + var podClient *framework.PodClient = f.PodClient() pod = podClient.Create(pod) ginkgo.By("waiting for pod running") @@ -607,8 +605,7 @@ var _ = framework.KubeDescribe("Variable Expansion", func() { // Start pod ginkgo.By(fmt.Sprintf("Creating pod %s", pod.Name)) - var podClient *framework.PodClient - podClient = f.PodClient() + var podClient *framework.PodClient = f.PodClient() pod = podClient.Create(pod) defer func() { e2epod.DeletePodWithWait(f.ClientSet, pod) @@ -640,9 +637,7 @@ var _ = framework.KubeDescribe("Variable Expansion", func() { }) func testPodFailSubpath(f *framework.Framework, pod *v1.Pod) { - - var podClient *framework.PodClient - podClient = f.PodClient() + var podClient *framework.PodClient = f.PodClient() pod = podClient.Create(pod) defer func() { diff --git a/test/e2e/common/kubelet_etc_hosts.go b/test/e2e/common/kubelet_etc_hosts.go index 3c3b67c9cfa..f29296a76ed 100644 --- a/test/e2e/common/kubelet_etc_hosts.go +++ b/test/e2e/common/kubelet_etc_hosts.go @@ -21,7 +21,7 @@ import ( "time" "github.com/onsi/ginkgo" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/klog" "k8s.io/kubernetes/test/e2e/framework" diff --git a/test/e2e/common/pods.go b/test/e2e/common/pods.go index 59091b49b91..26d4213ab38 100644 --- a/test/e2e/common/pods.go +++ b/test/e2e/common/pods.go @@ -26,7 +26,7 @@ import ( "golang.org/x/net/websocket" - v1 "k8s.io/api/core/v1" + "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" @@ -263,7 +263,7 @@ var _ = framework.KubeDescribe("Pods", func() { select { case <-listCompleted: select { - case event, _ := <-w.ResultChan(): + case event := <-w.ResultChan(): if event.Type != watch.Added { framework.Failf("Failed to observe pod creation: %v", event) } @@ -313,7 +313,7 @@ var _ = framework.KubeDescribe("Pods", func() { timer := time.After(framework.DefaultPodDeletionTimeout) for !deleted { select { - case event, _ := <-w.ResultChan(): + case event := <-w.ResultChan(): switch event.Type { case watch.Deleted: lastPod = event.Object.(*v1.Pod) @@ -604,10 +604,10 @@ var _ = framework.KubeDescribe("Pods", func() { buf.Write(msg[1:]) } if buf.Len() == 0 { - return fmt.Errorf("Unexpected output from server") + return fmt.Errorf("unexpected output from server") } if !strings.Contains(buf.String(), "remote execution test") { - return fmt.Errorf("Expected to find 'remote execution test' in %q", buf.String()) + return fmt.Errorf("expected to find 'remote execution test' in %q", buf.String()) } return nil }, time.Minute, 10*time.Second).Should(gomega.BeNil()) diff --git a/test/e2e/common/projected_combined.go b/test/e2e/common/projected_combined.go index 1fbb638f1b3..7660d5d280a 100644 --- a/test/e2e/common/projected_combined.go +++ b/test/e2e/common/projected_combined.go @@ -86,7 +86,7 @@ var _ = ginkgo.Describe("[sig-storage] Projected combined", func() { }, } f.TestContainerOutput("Check all projections for projected volume plugin", pod, 0, []string{ - fmt.Sprintf("%s", podName), + podName, "secret-value-1", "configmap-value-1", }) diff --git a/test/e2e/common/security_context.go b/test/e2e/common/security_context.go index 23d286adbd5..4084136e908 100644 --- a/test/e2e/common/security_context.go +++ b/test/e2e/common/security_context.go @@ -124,7 +124,7 @@ var _ = framework.KubeDescribe("Security Context", func() { framework.SkipIfNodeOSDistroIs("windows") name := "explicit-nonroot-uid" pod := makeNonRootPod(name, rootImage, pointer.Int64Ptr(1234)) - pod = podClient.Create(pod) + podClient.Create(pod) podClient.WaitForSuccess(name, framework.PodStartTimeout) framework.ExpectNoError(podClient.MatchContainerOutput(name, name, "1234")) @@ -144,7 +144,7 @@ var _ = framework.KubeDescribe("Security Context", func() { ginkgo.It("should run with an image specified user ID", func() { name := "implicit-nonroot-uid" pod := makeNonRootPod(name, nonRootImage, nil) - pod = podClient.Create(pod) + podClient.Create(pod) podClient.WaitForSuccess(name, framework.PodStartTimeout) framework.ExpectNoError(podClient.MatchContainerOutput(name, name, "1234"))