Skip to content

Commit

Permalink
Fix 4.1 upgrade (#57)
Browse files Browse the repository at this point in the history
* Require at least ocp 4.2, k8s 1.14.6 [SRVKS-371]

* Reduce mkv from 1.14.6 to 1.14.0 match official upstream

* Upgrade on OCP 4.1

* Fix approve_csv condition

* Update changelog with removed support for OCP 4.1

* Temporarily increase logging for upgrade tests

* Use if then for checking that the new CSV fails

* Fix check for ocp-41

* remove set -x
  • Loading branch information
mgencur authored and openshift-merge-robot committed Dec 12, 2019
1 parent eb2d358 commit 4871775
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -5,3 +5,4 @@
for more information.
- HTTPS based routes are now available for all Knative Services.
- Fixed a bug where Routes have non-correct cross-namespaced OwnerReferences.
- Dropped support for OpenShift 4.1
2 changes: 1 addition & 1 deletion hack/lib/common.bash
Expand Up @@ -35,7 +35,7 @@ function timeout {
echo -n '.'
fi
sleep $interval
[[ $seconds -gt $timeout ]] && logger.error "Timed out of ${timeout} exceeded" && return 1
[[ $seconds -gt $timeout ]] && logger.error "Time out of ${timeout} exceeded" && return 1
done
if [[ "${LOG_LEVEL}" != 'DEBUG' ]] && [[ "$seconds" != '0' ]]; then
echo ''
Expand Down
Expand Up @@ -100,6 +100,7 @@ spec:
kind: ServiceMeshControlPlane
name: servicemeshcontrolplanes.maistra.io
version: v1
minKubeVersion: 1.14.0
description: |-
The Red Hat Serverless Operator provides a collection of API's to
install various "serverless" services.
Expand Down
28 changes: 18 additions & 10 deletions test/lib.bash
Expand Up @@ -88,7 +88,7 @@ function run_knative_serving_tests {

# Rolling upgrade tests must run first because they upgrade Serverless to the latest version
if [[ $RUN_KNATIVE_SERVING_UPGRADE_TESTS == true ]]; then
run_knative_serving_rolling_upgrade_tests || failed=1
run_knative_serving_rolling_upgrade_tests || failed=1
fi

if [[ $RUN_KNATIVE_SERVING_E2E == true ]]; then
Expand All @@ -110,12 +110,11 @@ function run_knative_serving_e2e_and_conformance_tests {

function run_knative_serving_rolling_upgrade_tests {
logger.info "Running rolling upgrade tests"
local failed=0

go test -v -tags=preupgrade -timeout=20m ./test/upgrade \
--imagetemplate "$image_template" \
--kubeconfig "$KUBECONFIG" \
--resolvabledomain || failed=1
--resolvabledomain || return 1

logger.info "Starting prober test"

Expand All @@ -135,11 +134,20 @@ function run_knative_serving_rolling_upgrade_tests {

# Get the current/latest CSV
local upgrade_to=$(${rootdir}/hack/catalog.sh | grep currentCSV | awk '{ print $2 }')
approve_csv $upgrade_to || return 1

# The knativeserving CR should be updated now
timeout 900 '[[ ! ( $(oc get knativeserving knative-serving -n $SERVING_NAMESPACE -o=jsonpath="{.status.version}") != $serving_version && $(oc get knativeserving knative-serving -n $SERVING_NAMESPACE -o=jsonpath="{.status.conditions[?(@.type==\"Ready\")].status}") == True ) ]]' || return 1

if [[ ${HOSTNAME} = *ocp-41* ]]; then
if approve_csv "$upgrade_to" ; then # Upgrade should fail on OCP 4.1
return 1
fi
# Check we got RequirementsNotMet error
[[ $(oc get ClusterServiceVersion $upgrade_to -n $OPERATORS_NAMESPACE -o=jsonpath="{.status.requirementStatus[?(@.name==\"$upgrade_to\")].message}") =~ "requirement not met: minKubeVersion" ]] || return 1
# Check KnativeServing still has the old version
[[ $(oc get knativeserving knative-serving -n $SERVING_NAMESPACE -o=jsonpath="{.status.version}") == "$serving_version" ]] || return 1
else
approve_csv "$upgrade_to" || return 1
# The knativeserving CR should be updated now
timeout 900 '[[ ! ( $(oc get knativeserving knative-serving -n $SERVING_NAMESPACE -o=jsonpath="{.status.version}") != $serving_version && $(oc get knativeserving knative-serving -n $SERVING_NAMESPACE -o=jsonpath="{.status.conditions[?(@.type==\"Ready\")].status}") == True ) ]]' || return 1
fi
end_prober_test ${PROBER_PID}
fi

Expand All @@ -149,7 +157,7 @@ function run_knative_serving_rolling_upgrade_tests {
end_prober_test ${PROBER_PID}

local latest_cluster_version=$(oc adm upgrade | sed -ne '/VERSION/,$ p' | grep -v VERSION | awk '{print $1}')
[[ $latest_cluster_version == "" ]] && return 1
[[ $latest_cluster_version != "" ]] || return 1

oc adm upgrade --to-latest=true

Expand All @@ -166,11 +174,11 @@ function run_knative_serving_rolling_upgrade_tests {
go test -v -tags=postupgrade -timeout=20m ./test/upgrade \
--imagetemplate "$image_template" \
--kubeconfig "$KUBECONFIG" \
--resolvabledomain || failed=1
--resolvabledomain || return 1

oc delete ksvc pizzaplanet-upgrade-service scale-to-zero-upgrade-service upgrade-probe -n serving-tests

return $failed
return 0
}

function end_prober_test {
Expand Down

0 comments on commit 4871775

Please sign in to comment.