mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #108507 from liggitt/service-account-test
Restore wait loop to integration test
This commit is contained in:
commit
f66a4e39ad
@ -285,6 +285,22 @@ func TestServiceAccountTokenAuthentication(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("could not delete token: %v", err)
|
t.Fatalf("could not delete token: %v", err)
|
||||||
}
|
}
|
||||||
|
// wait for delete to be observed and reacted to via watch
|
||||||
|
err = wait.PollImmediate(100*time.Millisecond, 30*time.Second, func() (bool, error) {
|
||||||
|
_, err := roClient.CoreV1().Secrets(myns).List(context.TODO(), metav1.ListOptions{})
|
||||||
|
if err == nil {
|
||||||
|
t.Logf("token is still valid, waiting")
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
if !apierrors.IsUnauthorized(err) {
|
||||||
|
t.Logf("expected unauthorized error, got %v", err)
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("waiting for token to be invalidated: %v", err)
|
||||||
|
}
|
||||||
doServiceAccountAPIRequests(t, roClient, myns, false, false, false)
|
doServiceAccountAPIRequests(t, roClient, myns, false, false, false)
|
||||||
|
|
||||||
// Create "rw" user in myns
|
// Create "rw" user in myns
|
||||||
|
Loading…
Reference in New Issue
Block a user