diff --git a/test/integration/concierge_credentialrequest_test.go b/test/integration/concierge_credentialrequest_test.go index d0df40fd..ba151358 100644 --- a/test/integration/concierge_credentialrequest_test.go +++ b/test/integration/concierge_credentialrequest_test.go @@ -54,6 +54,7 @@ func TestSuccessfulCredentialRequest(t *testing.T) { return response.Status.Credential != nil } assert.Eventually(t, successfulResponse, 10*time.Second, 500*time.Millisecond) + require.NotNil(t, response) require.NotNil(t, response.Status.Credential) require.Empty(t, response.Status.Message) require.Empty(t, response.Spec) diff --git a/test/library/access.go b/test/library/access.go index 89b74704..ee96e7c6 100644 --- a/test/library/access.go +++ b/test/library/access.go @@ -26,7 +26,7 @@ const ( accessRetryTimeout = 10 * time.Second ) -// accessAsUserTest runs a generic test in which a clientUnderTest operating with username +// AccessAsUserTest runs a generic test in which a clientUnderTest operating with username // testUsername tries to auth to the kube API (i.e., list namespaces). // // Use this function if you want to simply validate that a user can auth to the kube API after @@ -49,6 +49,7 @@ func AccessAsUserTest( } assert.Eventually(t, canListNamespaces, accessRetryTimeout, accessRetryInterval) require.NoError(t, err) // prints out the error and stops the test in case of failure + require.NotNil(t, listNamespaceResponse) require.NotEmpty(t, listNamespaceResponse.Items) } } @@ -73,11 +74,11 @@ func AccessAsUserWithKubectlTest( assert.Eventually(t, canListNamespaces, accessRetryTimeout, accessRetryInterval) require.NoError(t, err) // prints out the error and stops the test in case of failure - require.Contains(t, kubectlCommandOutput, expectedNamespace) + require.Containsf(t, kubectlCommandOutput, expectedNamespace, "actual output: %q", kubectlCommandOutput) } } -// accessAsGroupTest runs a generic test in which a clientUnderTest with membership in group +// AccessAsGroupTest runs a generic test in which a clientUnderTest with membership in group // testGroup tries to auth to the kube API (i.e., list namespaces). // // Use this function if you want to simply validate that a user can auth to the kube API (via @@ -100,6 +101,7 @@ func AccessAsGroupTest( } assert.Eventually(t, canListNamespaces, accessRetryTimeout, accessRetryInterval) require.NoError(t, err) // prints out the error and stops the test in case of failure + require.NotNil(t, listNamespaceResponse) require.NotEmpty(t, listNamespaceResponse.Items) } } @@ -124,7 +126,7 @@ func AccessAsGroupWithKubectlTest( assert.Eventually(t, canListNamespaces, accessRetryTimeout, accessRetryInterval) require.NoError(t, err) // prints out the error and stops the test in case of failure - require.Contains(t, kubectlCommandOutput, expectedNamespace) + require.Containsf(t, kubectlCommandOutput, expectedNamespace, "actual output: %q", kubectlCommandOutput) } }