Tweak some assertions in TestSupervisorOIDCDiscovery.
We've seen some test flakes caused by this test. Some small changes: - Use a 30s timeout for each iteration of the test loop (so each iteration needs to check or fail more quickly). - Log a bit more during the checks so we can diagnose what's going on. - Increase the overall timeout from one minute to five minutes Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
parent
f69d095a69
commit
5e95c25d4f
@ -602,18 +602,25 @@ func requireDelete(t *testing.T, client pinnipedclientset.Interface, ns, name st
|
|||||||
|
|
||||||
func requireStatus(t *testing.T, client pinnipedclientset.Interface, ns, name string, status v1alpha1.FederationDomainStatusCondition) {
|
func requireStatus(t *testing.T, client pinnipedclientset.Interface, ns, name string, status v1alpha1.FederationDomainStatusCondition) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
var federationDomain *v1alpha1.FederationDomain
|
var federationDomain *v1alpha1.FederationDomain
|
||||||
var err error
|
var err error
|
||||||
assert.Eventually(t, func() bool {
|
assert.Eventually(t, func() bool {
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
federationDomain, err = client.ConfigV1alpha1().FederationDomains(ns).Get(ctx, name, metav1.GetOptions{})
|
federationDomain, err = client.ConfigV1alpha1().FederationDomains(ns).Get(ctx, name, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Logf("error trying to get FederationDomain: %s", err.Error())
|
t.Logf("error trying to get FederationDomain %s/%s: %v", ns, name, err)
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
return err == nil && federationDomain.Status.Status == status
|
|
||||||
}, time.Minute, 200*time.Millisecond)
|
if federationDomain.Status.Status != status {
|
||||||
|
t.Logf("found FederationDomain %s/%s with status %s", ns, name, federationDomain.Status.Status)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}, 5*time.Minute, 200*time.Millisecond)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equalf(t, status, federationDomain.Status.Status, "unexpected status (message = '%s')", federationDomain.Status.Message)
|
require.Equalf(t, status, federationDomain.Status.Status, "unexpected status (message = '%s')", federationDomain.Status.Message)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user