In TestSupervisorLogin, wrap the discovery request in an `Eventually()`.

Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
Matt Moyer 2020-12-02 18:07:52 -06:00
parent 879525faac
commit 64ef53402d
No known key found for this signature in database
GPG Key ID: EAE88AD172C5AE2D
1 changed files with 6 additions and 1 deletions

View File

@ -17,6 +17,7 @@ import (
"time" "time"
"github.com/coreos/go-oidc" "github.com/coreos/go-oidc"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"golang.org/x/oauth2" "golang.org/x/oauth2"
@ -100,7 +101,11 @@ func TestSupervisorLogin(t *testing.T) {
}, idpv1alpha1.PhaseReady) }, idpv1alpha1.PhaseReady)
// Perform OIDC discovery for our downstream. // Perform OIDC discovery for our downstream.
discovery, err := oidc.NewProvider(oidc.ClientContext(ctx, httpClient), downstream.Spec.Issuer) var discovery *oidc.Provider
assert.Eventually(t, func() bool {
discovery, err = oidc.NewProvider(oidc.ClientContext(ctx, httpClient), downstream.Spec.Issuer)
return err == nil
}, 60*time.Second, 1*time.Second)
require.NoError(t, err) require.NoError(t, err)
// Start a callback server on localhost. // Start a callback server on localhost.