diff --git a/scripts/install_local.sh b/scripts/install_local.sh index cb1b05edf0..013494fc04 100755 --- a/scripts/install_local.sh +++ b/scripts/install_local.sh @@ -4,7 +4,7 @@ set -e -if [[ ${#@} < 2 ]]; then +if [[ ${#@} -ne 2 ]]; then echo "Usage: $0 namespace chart" echo "* namespace: namespace to install into" echo "* chart: directory of chart manifests to install" @@ -15,32 +15,34 @@ namespace=$1 chart=$2 # create OLM -for f in ${chart}/*.yaml +for f in "${chart}"/*.yaml do if [[ $f == *.configmap.yaml ]] then - kubectl replace --force -f ${f}; + kubectl replace --force -f "${f}" else - kubectl apply -f ${f}; + kubectl apply -f "${f}" fi done # wait for deployments to be ready -kubectl rollout status -w deployment/olm-operator --namespace=${namespace} -kubectl rollout status -w deployment/catalog-operator --namespace=${namespace} - -# wait for packageserver deployment to be ready -retries=10 -until [[ $retries == 0 || $(kubectl rollout status -w deployment/packageserver --namespace=${namespace}) ]]; do - sleep 5 +kubectl rollout status -w deployment/olm-operator --namespace="${namespace}" +kubectl rollout status -w deployment/catalog-operator --namespace="${namespace}" + +retries=50 +until [[ $retries == 0 || $new_csv_phase == "Succeeded" ]]; do + new_csv_phase=$(kubectl get csv -n "${namespace}" packageserver.v1.0.0 -o jsonpath='{.status.phase}' 2>/dev/null || echo "Waiting for CSV to appear") + if [[ $new_csv_phase != "$csv_phase" ]]; then + csv_phase=$new_csv_phase + echo "Package server phase: $csv_phase" + fi + sleep 1 retries=$((retries - 1)) - echo "retrying check rollout status for deployment \"packageserver\"..." done -if [ $retries == 0 ] -then - echo "deployment \"packageserver\" failed to roll out" +if [ $retries == 0 ]; then + echo "CSV \"packageserver.v1.0.0\" failed to reach phase succeeded" exit 1 fi - echo "deployment \"packageserver\" successfully rolled out" +kubectl rollout status -w deployment/packageserver --namespace="${namespace}" diff --git a/scripts/run_e2e_local.sh b/scripts/run_e2e_local.sh index 9826248f49..9ea2de13a0 100755 --- a/scripts/run_e2e_local.sh +++ b/scripts/run_e2e_local.sh @@ -36,6 +36,9 @@ function cleanupAndExit { kubectl -n "${namespace}" logs -l app=olm-operator > olm.log; kubectl -n "${namespace}" logs -l app=catalog-operator > catalog.log; kubectl -n "${namespace}" logs -l app=packageserver > package.log + + # make it obvious if a pod is crashing or has restarted + kubectl get po --all-namespaces else cleanup fi diff --git a/test/e2e/util_test.go b/test/e2e/util_test.go index 0bfc8c5888..7b01ecf3fd 100644 --- a/test/e2e/util_test.go +++ b/test/e2e/util_test.go @@ -41,8 +41,9 @@ const ( pollInterval = 1 * time.Second pollDuration = 3 * time.Minute - ocsConfigMap = "rh-operators" - olmConfigMap = "olm-operators" + ocsConfigMap = "rh-operators" + olmConfigMap = "olm-operators" + // sync name with scripts/install_local.sh packageServerCSV = "packageserver.v1.0.0" )