diff --git a/test/e2e/serviceaccountissuer.go b/test/e2e/serviceaccountissuer.go index 4adb555a8f..d19f22cc78 100644 --- a/test/e2e/serviceaccountissuer.go +++ b/test/e2e/serviceaccountissuer.go @@ -18,6 +18,7 @@ import ( g "github.com/onsi/ginkgo/v2" "github.com/openshift/cluster-kube-apiserver-operator/pkg/operator/operatorclient" + testlibraryapi "github.com/openshift/library-go/test/library/apiserver" ) const ( @@ -26,15 +27,14 @@ const ( ) var _ = g.Describe("[sig-api-machinery] kube-apiserver operator", func() { - g.It("[Operator][Serial] serviceaccountissuer set in authentication config results in apiserver config", func() { + g.It("[Operator][Serial][Timeout:30m] serviceaccountissuer lifecycle test", func() { + g.By("serviceaccountissuer set in authentication config results in apiserver config") testServiceAccountIssuerFirstIssuer(g.GinkgoTB()) - }) - g.It("[Operator][Serial] second serviceaccountissuer set in authentication config results in apiserver config with two issuers", func() { + g.By("second serviceaccountissuer set in authentication config results in apiserver config with two issuers") testServiceAccountIssuerSecondIssuer(g.GinkgoTB()) - }) - g.It("[Operator][Serial] no serviceaccountissuer set in authentication config results in apiserver config with default issuer set", func() { + g.By("no serviceaccountissuer set in authentication config results in apiserver config with default issuer set") testServiceAccountIssuerDefaultIssuer(g.GinkgoTB()) }) }) @@ -82,6 +82,8 @@ func testServiceAccountIssuerDefaultIssuer(t testing.TB) { setServiceAccountIssuer(t, authConfigClient, "") err = pollForOperandIssuer(t, kubeClient, []string{"https://kubernetes.default.svc"}) require.NoError(t, err, "pollForOperandIssuer failed") + // Wait for API server to stabilize after configuration change + testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision(t, kubeClient.Pods(operatorclient.TargetNamespace)) } func pollForOperandIssuer(t testing.TB, client clientcorev1.CoreV1Interface, expectedIssuers []string) error { diff --git a/test/e2e/serviceaccountissuer_test.go b/test/e2e/serviceaccountissuer_test.go index 59d165badd..a866bbd44e 100644 --- a/test/e2e/serviceaccountissuer_test.go +++ b/test/e2e/serviceaccountissuer_test.go @@ -4,29 +4,25 @@ import ( "testing" ) -// This test calls the shared function which -// can be called from both standard Go tests and Ginkgo tests. +// This test calls the shared functions which can be called from both +// standard Go tests and Ginkgo tests. This test runs all three phases +// sequentially to verify the service account issuer lifecycle: +// 1. Setting first issuer +// 2. Setting second issuer (verifies first is retained as trusted) +// 3. Resetting to default issuer // // This situation is temporary until we test the new e2e-gcp-operator-serial-ote job. // Eventually all tests will be run only as part of the OTE framework. -func TestServiceAccountIssuerFirstIssuer(t *testing.T) { - testServiceAccountIssuerFirstIssuer(t) -} +func TestServiceAccountIssuer(t *testing.T) { + t.Run("serviceaccountissuer set in authentication config results in apiserver config", func(t *testing.T) { + testServiceAccountIssuerFirstIssuer(t) + }) -// This test calls the shared function which -// can be called from both standard Go tests and Ginkgo tests. -// -// This situation is temporary until we test the new e2e-gcp-operator-serial-ote job. -// Eventually all tests will be run only as part of the OTE framework. -func TestServiceAccountIssuerSecondIssuer(t *testing.T) { - testServiceAccountIssuerSecondIssuer(t) -} + t.Run("second serviceaccountissuer set in authentication config results in apiserver config with two issuers", func(t *testing.T) { + testServiceAccountIssuerSecondIssuer(t) + }) -// This test calls the shared function which -// can be called from both standard Go tests and Ginkgo tests. -// -// This situation is temporary until we test the new e2e-gcp-operator-serial-ote job. -// Eventually all tests will be run only as part of the OTE framework. -func TestServiceAccountIssuerDefaultIssuer(t *testing.T) { - testServiceAccountIssuerDefaultIssuer(t) + t.Run("no serviceaccountissuer set in authentication config results in apiserver config with default issuer set", func(t *testing.T) { + testServiceAccountIssuerDefaultIssuer(t) + }) }