Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(test): adds CSV phase reporting for package server #745

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions scripts/install_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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}"
3 changes: 3 additions & 0 deletions scripts/run_e2e_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions test/e2e/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down