diff --git a/.github/actions/kind/action.yml b/.github/actions/kind/action.yml index 58122e8a..268c48a5 100644 --- a/.github/actions/kind/action.yml +++ b/.github/actions/kind/action.yml @@ -35,7 +35,7 @@ runs: EOF' - name: Setup KinD cluster - uses: helm/kind-action@v1.5.0 + uses: helm/kind-action@v1.8.0 with: cluster_name: cluster version: v0.17.0 diff --git a/.github/workflows/olm_tests.yaml b/.github/workflows/olm_tests.yaml index 9e1061c9..6f88029e 100644 --- a/.github/workflows/olm_tests.yaml +++ b/.github/workflows/olm_tests.yaml @@ -72,6 +72,11 @@ jobs: # wait for a while to be sure CRDs are installed sleep 1 kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${OLM_VERSION}/olm.yaml + echo Wait for default CatalogSource to start + kubectl wait -n ${{ env.CATALOG_SOURCE_NAMESPACE }} catalogsource/${{ env.CATALOG_SOURCE_NAME }} --for=jsonpath='{.status.connectionState.lastObservedState}'=READY --timeout=180s + env: + CATALOG_SOURCE_NAME: "operatorhubio-catalog" + CATALOG_SOURCE_NAMESPACE: "olm" - name: Create openshift-operator namespace and OperatorGroup run: | @@ -87,15 +92,18 @@ jobs: envsubst < .github/resources-olm-upgrade/subscription.yaml > ${{ env.TEMP_DIR }}/subscription.yaml kubectl create -f ${{ env.TEMP_DIR }}/catalogsource.yaml - make wait-for-catalog-source + + echo Wait for CatalogSource ${{ env.CATALOG_SOURCE_NAME }} to start + kubectl wait -n ${{ env.CATALOG_SOURCE_NAMESPACE }} catalogsource/${{ env.CATALOG_SOURCE_NAME }} --for=jsonpath='{.status.connectionState.lastObservedState}'=READY --timeout=180s kubectl create -f ${{ env.TEMP_DIR }}/subscription.yaml echo Waiting for Subscription to be ready - make wait-for-subscription + kubectl wait -n ${{ env.SUBSCRIPTION_NAMESPACE }} subscription/${{ env.SUBSCRIPTION_NAME }} --for=jsonpath='{.status.state}'=AtLatestKnown --timeout=180s echo Waiting for Deployment to be ready - make wait-for-deployment -e TIMEOUT=60 -e DEPLOYMENT_NAME="codeflare-operator-manager" -e DEPLOYMENT_NAMESPACE="openshift-operators" + timeout 60 bash -c 'until [[ $(kubectl get deployment/codeflare-operator-manager -n '${{ env.SUBSCRIPTION_NAMESPACE }}') ]]; do sleep 5 && echo "$(kubectl get deployment/codeflare-operator-manager -n '${{ env.SUBSCRIPTION_NAMESPACE }}')"; done' + kubectl wait -n ${{ env.SUBSCRIPTION_NAMESPACE }} deployment/codeflare-operator-manager --for=condition=Available=true --timeout=60s env: CATALOG_SOURCE_NAME: "codeflare-olm-test" CATALOG_SOURCE_NAMESPACE: "olm" @@ -138,10 +146,11 @@ jobs: kubectl wait --timeout=120s --for=delete pod/${ORIGINAL_POD_NAME} -n openshift-operators echo Waiting for Subscription to be ready - make wait-for-subscription + kubectl wait -n ${{ env.SUBSCRIPTION_NAMESPACE }} subscription/${{ env.SUBSCRIPTION_NAME }} --for=jsonpath='{.status.state}'=AtLatestKnown --timeout=180s echo Waiting for Deployment to be ready - make wait-for-deployment -e TIMEOUT=60 -e DEPLOYMENT_NAME="codeflare-operator-manager" -e DEPLOYMENT_NAMESPACE="openshift-operators" + timeout 60 bash -c 'until [[ $(kubectl get deployment/codeflare-operator-manager -n '${{ env.SUBSCRIPTION_NAMESPACE }}') ]]; do sleep 5 && echo "$(kubectl get deployment/codeflare-operator-manager -n '${{ env.SUBSCRIPTION_NAMESPACE }}')"; done' + kubectl wait -n ${{ env.SUBSCRIPTION_NAMESPACE }} deployment/codeflare-operator-manager --for=condition=Available=true --timeout=60s echo Checking that correct CSV is available CSV_VERSION=$(kubectl get ClusterServiceVersion/codeflare-operator.${VERSION} -n openshift-operators -o json | jq -r .spec.version) diff --git a/Makefile b/Makefile index f10a8735..4aea9453 100644 --- a/Makefile +++ b/Makefile @@ -440,23 +440,3 @@ test-e2e: defaults manifests generate fmt vet ## Run e2e tests. .PHONY: setup-e2e setup-e2e: ## Set up e2e tests. KUBERAY_VERSION=$(KUBERAY_VERSION) test/e2e/setup.sh - -# Wait until CatalogSource is in "READY" state -.PHONY: wait-for-catalog-source -wait-for-catalog-source: - timeout 120 bash -c 'while [[ "$$(kubectl get catalogsource/'$(CATALOG_SOURCE_NAME)' -n '$(CATALOG_SOURCE_NAMESPACE)' -o json | jq -r .status.connectionState.lastObservedState)" != "READY" ]]; do sleep 5 && echo "$$(kubectl get catalogsource/'$(CATALOG_SOURCE_NAME)' -n '$(CATALOG_SOURCE_NAMESPACE)' -o json | jq -r .status.connectionState.lastObservedState)" ; done' - -# Wait until Subscription is in "AtLatestKnown" state -.PHONY: wait-for-subscription -wait-for-subscription: - timeout 300 bash -c 'while [[ "$$(kubectl get subscription/'$(SUBSCRIPTION_NAME)' -n '$(SUBSCRIPTION_NAMESPACE)' -o json | jq -r .status.state)" != "AtLatestKnown" ]]; do sleep 5 && echo "$$(kubectl get subscription/'$(SUBSCRIPTION_NAME)' -n '$(SUBSCRIPTION_NAMESPACE)' -o json | jq -r .status.state)" ; done' - -# Default timeout for waiting actions -TIMEOUT ?= 180 - -# Wait until Deployment is in "Available" state -.PHONY: wait-for-deployment -wait-for-deployment: - # Wait until Deployment exists first, then use kubectl wait - timeout $(TIMEOUT) bash -c 'until [[ $$(kubectl get deployment/'$(DEPLOYMENT_NAME)' -n '$(DEPLOYMENT_NAMESPACE)') ]]; do sleep 5 && echo "$$(kubectl get deployment/'$(DEPLOYMENT_NAME)' -n '$(DEPLOYMENT_NAMESPACE)')"; done' - kubectl wait --timeout=$(TIMEOUT)s --for=condition=Available=true deployment/$(DEPLOYMENT_NAME) -n $(DEPLOYMENT_NAMESPACE)