From 4e5455c72cc9922fcbe750989fddeb3be7268741 Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Thu, 19 Feb 2026 19:24:19 +0300 Subject: [PATCH] fix(e2e): poll for CRD existence before waiting for Established condition kubectl wait fails immediately with NotFound if the CRD does not exist yet. The operator creates CRDs asynchronously on startup, so wrap the wait in a retry loop that tolerates the initial absence. Co-Authored-By: Claude Signed-off-by: Aleksei Sviridkin --- hack/e2e-install-cozystack.bats | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hack/e2e-install-cozystack.bats b/hack/e2e-install-cozystack.bats index 2cfebfbff..43b8ab8f4 100644 --- a/hack/e2e-install-cozystack.bats +++ b/hack/e2e-install-cozystack.bats @@ -19,9 +19,10 @@ # Verify the operator deployment is available kubectl wait deployment/cozystack-operator -n cozy-system --timeout=1m --for=condition=Available - # Wait for operator to install CRDs (happens at startup before reconcile loop) - kubectl wait crd/packages.cozystack.io --for=condition=Established --timeout=2m - kubectl wait crd/packagesources.cozystack.io --for=condition=Established --timeout=2m + # Wait for operator to install CRDs (happens at startup before reconcile loop). + # kubectl wait fails immediately if the CRD does not exist yet, so poll until it appears first. + timeout 120 sh -ec 'until kubectl wait crd/packages.cozystack.io --for=condition=Established --timeout=10s 2>/dev/null; do sleep 2; done' + timeout 120 sh -ec 'until kubectl wait crd/packagesources.cozystack.io --for=condition=Established --timeout=10s 2>/dev/null; do sleep 2; done' # Wait for operator to create the platform PackageSource timeout 120 sh -ec 'until kubectl get packagesource cozystack.cozystack-platform >/dev/null 2>&1; do sleep 2; done'