Skip to content

Commit 0bb1953

Browse files
UPSTREAM: <carry>: Adds ResourceVersion checks to the tls secret deletion test, mirroring the logic used in the certificate rotation test. This makes the test more robust by ensuring a new secret is created, not just that an existing one is still present.
1 parent e9e3220 commit 0bb1953

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

openshift/tests-extension/test/webhooks.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,16 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMWebhookProviderOpenshiftServi
240240

241241
It("should be tolerant to tls secret deletion", func(ctx SpecContext) {
242242
certificateSecretName := webhookServiceCert
243-
By("ensuring secret exists before deletion attempt")
243+
var oldSecretResourceVersion string
244+
245+
By("ensuring secret exists before deletion attempt and getting its ResourceVersion")
244246
Eventually(func(g Gomega) {
245247
secret := &corev1.Secret{}
246248
err := k8sClient.Get(ctx, client.ObjectKey{Name: certificateSecretName, Namespace: webhookOperatorInstallNamespace}, secret)
247249
g.Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("failed to get secret %s/%s", webhookOperatorInstallNamespace, certificateSecretName))
248-
}).WithTimeout(1 * time.Minute).WithPolling(5 * time.Second).Should(Succeed())
250+
oldSecretResourceVersion = secret.ResourceVersion
251+
g.Expect(oldSecretResourceVersion).ToNot(BeEmpty(), "expected secret ResourceVersion to not be empty")
252+
}).WithTimeout(5 * time.Minute).WithPolling(5 * time.Second).Should(Succeed())
249253

250254
By("checking webhook is responsive through secret recreation after manual deletion")
251255
tlsSecret := &corev1.Secret{
@@ -286,6 +290,7 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMWebhookProviderOpenshiftServi
286290
return
287291
}
288292
g.Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("failed to get webhook service certificate secret %s/%s: %v", webhookOperatorInstallNamespace, certificateSecretName, err))
293+
g.Expect(secret.ResourceVersion).ToNot(Equal(oldSecretResourceVersion), "expected secret ResourceVersion to be different from the old one")
289294
g.Expect(secret.Data).ToNot(BeEmpty(), "expected webhook service certificate secret data to not be empty after recreation")
290295
}).WithTimeout(5*time.Minute).WithPolling(10*time.Second).Should(Succeed(), "webhook service certificate secret did not get recreated and populated within timeout")
291296

0 commit comments

Comments
 (0)