Fix integration test expectation for AKS clusters

This commit is contained in:
Ryan Richard 2022-09-26 17:00:11 -07:00
parent 0d215566d8
commit 563c193499

View File

@ -1032,5 +1032,12 @@ func TestOIDCClientSecretRequestUnauthenticated_Parallel(t *testing.T) {
},
}, metav1.CreateOptions{})
require.Error(t, err)
require.Contains(t, err.Error(), `User "system:anonymous" cannot create resource "oidcclientsecretrequests"`)
if env.KubernetesDistribution == testlib.AKSDistro {
// On AKS the error just says "Unauthorized".
require.Contains(t, err.Error(), "Unauthorized")
} else {
// Clusters which allow anonymous auth will give a more detailed error.
require.Contains(t, err.Error(), `User "system:anonymous" cannot create resource "oidcclientsecretrequests"`)
}
}