diff --git a/hack/.staticcheck_failures b/hack/.staticcheck_failures index 70d1a0d504f..d58a56af761 100644 --- a/hack/.staticcheck_failures +++ b/hack/.staticcheck_failures @@ -76,12 +76,8 @@ test/integration/framework test/integration/garbagecollector test/integration/master test/integration/replicationcontroller -test/integration/scale test/integration/scheduler_perf -test/integration/serviceaccount -test/integration/serving test/integration/ttlcontroller -test/integration/volume vendor/k8s.io/apimachinery/pkg/api/meta vendor/k8s.io/apimachinery/pkg/api/resource vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured diff --git a/test/integration/scale/scale_test.go b/test/integration/scale/scale_test.go index f3c7a8d01bb..85794f0daae 100644 --- a/test/integration/scale/scale_test.go +++ b/test/integration/scale/scale_test.go @@ -35,11 +35,6 @@ import ( "k8s.io/kubernetes/test/integration/framework" ) -type subresourceTest struct { - resource schema.GroupVersionResource - kind schema.GroupVersionKind -} - func makeGVR(group, version, resource string) schema.GroupVersionResource { return schema.GroupVersionResource{Group: group, Version: version, Resource: resource} } @@ -58,7 +53,7 @@ func TestScaleSubresources(t *testing.T) { }) defer tearDown() - resourceLists, err := clientSet.Discovery().ServerResources() + _, resourceLists, err := clientSet.Discovery().ServerGroupsAndResources() if err != nil { t.Fatal(err) } @@ -206,10 +201,6 @@ var ( } ) -func setup(t *testing.T) (client kubernetes.Interface, tearDown func()) { - return setupWithOptions(t, nil, nil) -} - func setupWithOptions(t *testing.T, instanceOptions *apitesting.TestServerInstanceOptions, flags []string) (client kubernetes.Interface, tearDown func()) { result := apitesting.StartTestServerOrDie(t, instanceOptions, flags, framework.SharedEtcd()) diff --git a/test/integration/serviceaccount/service_account_test.go b/test/integration/serviceaccount/service_account_test.go index 980ff0cd64b..3e3a414764b 100644 --- a/test/integration/serviceaccount/service_account_test.go +++ b/test/integration/serviceaccount/service_account_test.go @@ -115,7 +115,7 @@ func TestServiceAccountTokenAutoCreate(t *testing.T) { } // Create service account - serviceAccount, err := c.CoreV1().ServiceAccounts(ns).Create(&v1.ServiceAccount{ObjectMeta: metav1.ObjectMeta{Name: name}}) + _, err = c.CoreV1().ServiceAccounts(ns).Create(&v1.ServiceAccount{ObjectMeta: metav1.ObjectMeta{Name: name}}) if err != nil { t.Fatalf("Service Account not created: %v", err) } @@ -145,7 +145,7 @@ func TestServiceAccountTokenAutoCreate(t *testing.T) { } // Trigger creation of a new referenced token - serviceAccount, err = c.CoreV1().ServiceAccounts(ns).Get(name, metav1.GetOptions{}) + serviceAccount, err := c.CoreV1().ServiceAccounts(ns).Get(name, metav1.GetOptions{}) if err != nil { t.Fatal(err) } diff --git a/test/integration/serving/serving_test.go b/test/integration/serving/serving_test.go index b3b85a672bd..ba9aec0506d 100644 --- a/test/integration/serving/serving_test.go +++ b/test/integration/serving/serving_test.go @@ -292,6 +292,9 @@ func testComponent(t *testing.T, tester componentTester, kubeconfig, brokenKubec } body, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("failed to read response body: %v", err) + } defer r.Body.Close() if got, expected := r.StatusCode, *tt.wantSecureCode; got != expected { t.Fatalf("expected http %d at %s of component, got: %d %q", expected, tt.path, got, string(body)) @@ -307,6 +310,9 @@ func testComponent(t *testing.T, tester componentTester, kubeconfig, brokenKubec t.Fatalf("failed to GET %s from component: %v", tt.path, err) } body, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("failed to read response body: %v", err) + } defer r.Body.Close() if got, expected := r.StatusCode, *tt.wantInsecureCode; got != expected { t.Fatalf("expected http %d at %s of component, got: %d %q", expected, tt.path, got, string(body)) diff --git a/test/integration/volume/attach_detach_test.go b/test/integration/volume/attach_detach_test.go index e61d28fbe35..f63802b21e7 100644 --- a/test/integration/volume/attach_detach_test.go +++ b/test/integration/volume/attach_detach_test.go @@ -132,8 +132,6 @@ func fakePodWithPVC(name, pvcName, namespace string) (*v1.Pod, *v1.PersistentVol return fakePod, fakePVC } -type podCountFunc func(int) bool - var defaultTimerConfig = attachdetach.TimerConfig{ ReconcilerLoopPeriod: 100 * time.Millisecond, ReconcilerMaxWaitForUnmountDuration: 6 * time.Second, diff --git a/test/integration/volume/persistent_volumes_test.go b/test/integration/volume/persistent_volumes_test.go index 81853e6cbb8..84995edc0ae 100644 --- a/test/integration/volume/persistent_volumes_test.go +++ b/test/integration/volume/persistent_volumes_test.go @@ -666,11 +666,10 @@ func TestPersistentVolumeMultiPVsPVCs(t *testing.T) { select { case <-stopCh: - break + return default: continue } - } }()