From 336f0f167ab03dadb24101a99326178a6d4a2fee Mon Sep 17 00:00:00 2001 From: Baiju Muthukadan Date: Wed, 1 May 2019 09:04:05 +0530 Subject: [PATCH] Check for the existence of CRDs --- hack/check-crds.sh | 20 ++++++++++++++++++++ make/test.mk | 4 +--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100755 hack/check-crds.sh diff --git a/hack/check-crds.sh b/hack/check-crds.sh new file mode 100755 index 0000000..ff953c5 --- /dev/null +++ b/hack/check-crds.sh @@ -0,0 +1,20 @@ +#!/bin/bash +function check_crds() { + local crd_name=$1 + for i in {1..12} + do + oc get crds | grep $crd_name + if [ $? == 0 ] + then + echo "CRD exists: " $crd_name + return 0 + fi + sleep 5s + done + echo "CRD doesn't exist: " $crd_name + exit 1 +} + +check_crds components.devconsole.openshift.io +check_crds gitsourceanalyses.devconsole.openshift.io +check_crds gitsources.devconsole.openshift.io diff --git a/make/test.mk b/make/test.mk index e09141a..ffc014e 100644 --- a/make/test.mk +++ b/make/test.mk @@ -96,9 +96,7 @@ test-e2e-olm-ci: ./vendor $(Q)sed -e "s,REPLACE_IMAGE,registry.svc.ci.openshift.org/${OPENSHIFT_BUILD_NAMESPACE}/stable:devconsole-operator-registry," ./test/e2e/catalog_source_OS4.yaml | oc apply -f - $(Q)oc apply -f ./test/e2e/subscription_OS4.yaml $(eval DEPLOYED_NAMESPACE := openshift-operators) - $(Q)oc wait crd/components.devconsole.openshift.io --for=condition=Established --timeout=300s - $(Q)oc wait crd/gitsourceanalyses.devconsole.openshift.io --for=condition=Established --timeout=300s - $(Q)oc wait crd/gitsources.devconsole.openshift.io --for=condition=Established --timeout=300s + $(Q)./hack/check-crds.sh $(Q)operator-sdk test local ./test/e2e --no-setup --go-test-flags "-v -timeout=15m" .PHONY: test-e2e-ci