From 99099fd32f287a863c23d3527905e30740ec9c23 Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Mon, 17 May 2021 14:20:41 -0700 Subject: [PATCH] Yet more debugging of tests which only fail in main CI --- test/integration/ldap_client_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/integration/ldap_client_test.go b/test/integration/ldap_client_test.go index fb49a099..95446f3b 100644 --- a/test/integration/ldap_client_test.go +++ b/test/integration/ldap_client_test.go @@ -14,6 +14,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "k8s.io/apiserver/pkg/authentication/authenticator" "k8s.io/apiserver/pkg/authentication/user" @@ -404,7 +406,10 @@ func TestSimultaneousRequestsOnSingleProvider(t *testing.T) { resultCh := make(chan authUserResult, iterations) for i := 0; i < iterations; i++ { go func() { - authResponse, authenticated, err := provider.AuthenticateUser(ctx, + authUserCtx, authUserCtxCancelFunc := context.WithTimeout(context.Background(), 2*time.Minute) + defer authUserCtxCancelFunc() + + authResponse, authenticated, err := provider.AuthenticateUser(authUserCtx, env.SupervisorUpstreamLDAP.TestUserCN, env.SupervisorUpstreamLDAP.TestUserPassword, ) resultCh <- authUserResult{ @@ -416,9 +421,10 @@ func TestSimultaneousRequestsOnSingleProvider(t *testing.T) { } for i := 0; i < iterations; i++ { result := <-resultCh - require.NoError(t, result.err) - require.True(t, result.authenticated, "expected the user to be authenticated, but they were not") - require.Equal(t, &authenticator.Response{ + // Record failures but allow the test to keep running so that all the background goroutines have a chance to try. + assert.NoError(t, result.err) + assert.True(t, result.authenticated, "expected the user to be authenticated, but they were not") + assert.Equal(t, &authenticator.Response{ User: &user.DefaultInfo{Name: "pinny", UID: "1000", Groups: []string{}}, }, result.response) }