mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Minor cleanup to use t.Run() in test/integration
This commit is contained in:
parent
f0791b5014
commit
04b77f02ee
@ -115,7 +115,7 @@ func TestBootstrapTokenAuth(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
authenticator := group.NewAuthenticatedGroupAdder(bearertoken.New(bootstrap.NewTokenAuthenticator(bootstrapSecrets{test.secret})))
|
||||
// Set up an API server
|
||||
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
@ -177,5 +177,6 @@ func TestBootstrapTokenAuth(t *testing.T) {
|
||||
}
|
||||
|
||||
}()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -518,6 +518,7 @@ func TestRBAC(t *testing.T) {
|
||||
}
|
||||
|
||||
for i, tc := range tests {
|
||||
t.Run(fmt.Sprintf("case-%d", i), func(t *testing.T) {
|
||||
// Create an API Server.
|
||||
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
controlPlaneConfig.GenericConfig.Authorization.Authorizer = newRBACAuthorizer(t, controlPlaneConfig)
|
||||
@ -544,7 +545,7 @@ func TestRBAC(t *testing.T) {
|
||||
superuserClient, _ := clientsetForToken(superUser, clientConfig)
|
||||
if err := tc.bootstrapRoles.bootstrap(superuserClient); err != nil {
|
||||
t.Errorf("case %d: failed to apply initial roles: %v", i, err)
|
||||
continue
|
||||
return
|
||||
}
|
||||
previousResourceVersion := make(map[string]float64)
|
||||
|
||||
@ -636,6 +637,7 @@ func TestRBAC(t *testing.T) {
|
||||
}
|
||||
}()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -422,7 +422,7 @@ func TestAdoption(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for i, tc := range testCases {
|
||||
func() {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
s, closeFn, rm, informers, clientSet := rmSetup(t)
|
||||
defer closeFn()
|
||||
ns := framework.CreateTestingNamespace(fmt.Sprintf("rs-adoption-%d", i), s, t)
|
||||
@ -461,7 +461,7 @@ func TestAdoption(t *testing.T) {
|
||||
}); err != nil {
|
||||
t.Fatalf("test %q failed: %v", tc.name, err)
|
||||
}
|
||||
}()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ func TestAdoption(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for i, tc := range testCases {
|
||||
func() {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
s, closeFn, rm, informers, clientSet := rmSetup(t)
|
||||
defer closeFn()
|
||||
ns := framework.CreateTestingNamespace(fmt.Sprintf("rc-adoption-%d", i), s, t)
|
||||
@ -449,7 +449,7 @@ func TestAdoption(t *testing.T) {
|
||||
}); err != nil {
|
||||
t.Fatalf("test %q failed: %v", tc.name, err)
|
||||
}
|
||||
}()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,6 +262,7 @@ func TestStatefulSetAvailable(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.StatefulSetMinReadySeconds, test.enabled)()
|
||||
s, closeFn, rm, informers, c := scSetup(t)
|
||||
defer closeFn()
|
||||
@ -309,6 +310,7 @@ func TestStatefulSetAvailable(t *testing.T) {
|
||||
}); err != nil {
|
||||
t.Fatalf("Failed to verify number of Replicas, ReadyReplicas and AvailableReplicas of rs %s to be as expected: %v", sts.Name, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user