Skip to content

Commit 7ab35bc

Browse files
committed
fix e2e
Signed-off-by: chiragkyal <ckyal@redhat.com>
1 parent 4cc2a78 commit 7ab35bc

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

test/e2e/trustmanager_bundle_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -727,23 +727,22 @@ var _ = Describe("Bundle", Ordered, Label("Feature:TrustManager"), func() {
727727
WithFilterExpiredCertificates(v1alpha1.FilterExpiredCertificatesPolicyEnabled))
728728

729729
sourceCMName = "filter-src-cm-" + randomStr(5)
730+
filterBundleName = "bundle-filter-expired-" + randomStr(5)
730731
combinedPEM := testCertPEM1 + expiredCertPEM
731732

732733
By("creating source ConfigMap with valid + expired certs in trust namespace")
733734
createSourceConfigMap(ctx, trustManagerNamespace, sourceCMName, bundleSourceKey, combinedPEM)
734-
})
735-
AfterAll(func() { deleteTrustManager(ctx) })
736-
737-
It("should exclude expired certificates from ConfigMap target when using ConfigMap source", func() {
738-
filterBundleName = "bundle-filter-expired-" + randomStr(5)
739735

740736
bundle := newBundle(filterBundleName).
741737
WithConfigMapSource(sourceCMName, bundleSourceKey).
742738
WithConfigMapTarget(bundleTargetKey).
743739
Build()
744740

745741
createBundleWithCleanup(ctx, bundle)
742+
})
743+
AfterAll(func() { deleteTrustManager(ctx) })
746744

745+
It("should exclude expired certificates from ConfigMap target when using ConfigMap source", func() {
747746
By("verifying target contains the valid certificate")
748747
err := waitForConfigMapTarget(ctx, bundleClient, filterBundleName, testNS.Name, bundleTargetKey, testCertPEM1, highTimeout)
749748
Expect(err).ShouldNot(HaveOccurred())

test/e2e/trustmanager_helpers_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,13 @@ func deleteBundle(ctx context.Context, name string) {
301301
}
302302

303303
func createBundleWithCleanup(ctx context.Context, bundle *trustapi.Bundle) {
304-
Expect(bundleClient.Create(ctx, bundle)).ShouldNot(HaveOccurred())
304+
Eventually(func() error {
305+
err := bundleClient.Create(ctx, bundle)
306+
if apierrors.IsAlreadyExists(err) {
307+
return nil
308+
}
309+
return err
310+
}, lowTimeout, fastPollInterval).Should(Succeed(), "failed to create Bundle %q (webhook may not be ready yet)", bundle.Name)
305311
DeferCleanup(func() { deleteBundle(ctx, bundle.Name) })
306312
}
307313

0 commit comments

Comments
 (0)