Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions test/e2e/serviceaccountissuer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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())
})
})
Expand Down Expand Up @@ -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))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this really required ? (it wasn't before)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is required, kas getting rollout after after config change which intermittently impacting other cases.

}

func pollForOperandIssuer(t testing.TB, client clientcorev1.CoreV1Interface, expectedIssuers []string) error {
Expand Down
36 changes: 16 additions & 20 deletions test/e2e/serviceaccountissuer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}