Skip to content

Commit

Permalink
test: Fix flaky telemetry test (#1702)
Browse files Browse the repository at this point in the history
  • Loading branch information
skhalash authored Dec 19, 2024
1 parent 9f1d4fe commit d402740
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/e2e/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package e2e

import (
"fmt"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -186,7 +187,7 @@ var _ = Describe(suite.ID(), Label(suite.LabelTelemetry), Ordered, func() {
})

AfterAll(func() {
// Re-create Telemetry for remaining tests
// Recreate Telemetry for remaining tests
Eventually(func(g Gomega) {
newTelemetry := []client.Object{kitk8s.NewTelemetry("default", "kyma-system").K8sObject()}
g.Expect(kitk8s.CreateObjects(ctx, k8sClient, newTelemetry...)).Should(Succeed())
Expand All @@ -197,6 +198,13 @@ var _ = Describe(suite.ID(), Label(suite.LabelTelemetry), Ordered, func() {
g.Expect(k8sClient.Get(ctx, kitkyma.TelemetryName, &telemetry)).Should(Succeed())
g.Expect(telemetry.Status.State).Should(Equal(operatorv1alpha1.StateReady))
}, periodic.EventuallyTimeout, periodic.DefaultInterval).Should(Succeed())

// When the Telemetry CR is deleted, the CA cert secret is also deleted. Upon recreating the Telemetry CR,
// the CA cert, server cert, and CA bundles in the webhook configurations are regenerated.
// However, due to this change: https://github.com/kubernetes-sigs/controller-runtime/pull/3020,
// the HTTPS server may take up to 10 seconds to start using the new cert.
// This sleep ensures the server has sufficient time to switch to the new cert.
time.Sleep(15 * time.Second)
})

It("Should have Telemetry resource", func() {
Expand Down

0 comments on commit d402740

Please sign in to comment.