Skip to content

Commit b5c69a1

Browse files
Merge pull request #745 from jpeeler/deploy-status
feat(test): adds CSV phase reporting for package server
2 parents 22543bd + fffb666 commit b5c69a1

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

scripts/install_local.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
set -e
66

7-
if [[ ${#@} < 2 ]]; then
7+
if [[ ${#@} -ne 2 ]]; then
88
echo "Usage: $0 namespace chart"
99
echo "* namespace: namespace to install into"
1010
echo "* chart: directory of chart manifests to install"
@@ -15,32 +15,34 @@ namespace=$1
1515
chart=$2
1616

1717
# create OLM
18-
for f in ${chart}/*.yaml
18+
for f in "${chart}"/*.yaml
1919
do
2020
if [[ $f == *.configmap.yaml ]]
2121
then
22-
kubectl replace --force -f ${f};
22+
kubectl replace --force -f "${f}"
2323
else
24-
kubectl apply -f ${f};
24+
kubectl apply -f "${f}"
2525
fi
2626
done
2727

2828
# wait for deployments to be ready
29-
kubectl rollout status -w deployment/olm-operator --namespace=${namespace}
30-
kubectl rollout status -w deployment/catalog-operator --namespace=${namespace}
31-
32-
# wait for packageserver deployment to be ready
33-
retries=10
34-
until [[ $retries == 0 || $(kubectl rollout status -w deployment/packageserver --namespace=${namespace}) ]]; do
35-
sleep 5
29+
kubectl rollout status -w deployment/olm-operator --namespace="${namespace}"
30+
kubectl rollout status -w deployment/catalog-operator --namespace="${namespace}"
31+
32+
retries=50
33+
until [[ $retries == 0 || $new_csv_phase == "Succeeded" ]]; do
34+
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")
35+
if [[ $new_csv_phase != "$csv_phase" ]]; then
36+
csv_phase=$new_csv_phase
37+
echo "Package server phase: $csv_phase"
38+
fi
39+
sleep 1
3640
retries=$((retries - 1))
37-
echo "retrying check rollout status for deployment \"packageserver\"..."
3841
done
3942

40-
if [ $retries == 0 ]
41-
then
42-
echo "deployment \"packageserver\" failed to roll out"
43+
if [ $retries == 0 ]; then
44+
echo "CSV \"packageserver.v1.0.0\" failed to reach phase succeeded"
4345
exit 1
4446
fi
4547

46-
echo "deployment \"packageserver\" successfully rolled out"
48+
kubectl rollout status -w deployment/packageserver --namespace="${namespace}"

scripts/run_e2e_local.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ function cleanupAndExit {
3636
kubectl -n "${namespace}" logs -l app=olm-operator > olm.log;
3737
kubectl -n "${namespace}" logs -l app=catalog-operator > catalog.log;
3838
kubectl -n "${namespace}" logs -l app=packageserver > package.log
39+
40+
# make it obvious if a pod is crashing or has restarted
41+
kubectl get po --all-namespaces
3942
else
4043
cleanup
4144
fi

test/e2e/util_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ const (
4141
pollInterval = 1 * time.Second
4242
pollDuration = 3 * time.Minute
4343

44-
ocsConfigMap = "rh-operators"
45-
olmConfigMap = "olm-operators"
44+
ocsConfigMap = "rh-operators"
45+
olmConfigMap = "olm-operators"
46+
// sync name with scripts/install_local.sh
4647
packageServerCSV = "packageserver.v1.0.0"
4748
)
4849

0 commit comments

Comments
 (0)