mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
fix staticcheck failures of test/integration/scale test/integration/serviceaccount test/integration/serving test/integration/volume
This commit is contained in:
parent
bd239d42e4
commit
8c77b96b75
@ -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
|
||||
|
@ -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())
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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))
|
||||
|
@ -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,
|
||||
|
@ -666,11 +666,10 @@ func TestPersistentVolumeMultiPVsPVCs(t *testing.T) {
|
||||
|
||||
select {
|
||||
case <-stopCh:
|
||||
break
|
||||
return
|
||||
default:
|
||||
continue
|
||||
}
|
||||
|
||||
}
|
||||
}()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user