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

[WIP] OTA-1415 Enabled test step 9 of test case OCP-77520 oc adm upgreade recommend #60896

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,37 @@ function upgrade() {
echo "Upgrading cluster to ${TARGET} gets started..."
}

# this is the test step 9 for https://polarion.engineering.redhat.com/polarion/#/project/OSE/workitem?id=OCP-77520
function check_upgrade_recommend_when_upgrade_inprogress() {
if [[ -n "${SOURCE_MINOR_VERSION}" ]] && [[ "${SOURCE_MINOR_VERSION}" -le "17" ]] ; then
echo "oc adm upgrade recommend is enabled in OCP 4.18, skip"
return 0
fi
# So far, this is a TP feature in OCP 4.18 and OCP 4.19, so need to enable the gate
export OC_ENABLE_CMD_UPGRADE_RECOMMEND=true
local out
local info="info: An update is in progress. You may wish to let this update complete before requesting a new update."
local no_update="No updates available. You may still upgrade to a specific release image with --to-image or wait for new updates to be available."
local error="error: no updates available, so cannot display context for the requested release 4.999.999"

out="$(oc adm upgrade recommend)"
if [[ "${out}" != *"${info}"* ]] || [[ "${out}" != *"${no_update}"* ]]; then
echo "OCP-77520: Command \"oc adm upgrade recommend\" should output \"${info}\" and \"${no_update}\", but actualy not: \"${out}\""
return 1
fi
out="$(oc adm upgrade recommend --show-outdated-releases)"
if [[ "${out}" != *"${info}"* ]] || [[ "${out}" != *"${no_update}"* ]]; then
echo "OCP-77520: Command \"oc adm upgrade recommend --show-outdated-releases\" should output \"${info}\" and \"${no_update}\", but actualy not: \"${out}\""
return 1
fi
out="$(oc adm upgrade recommend --version 4.999.999)"
if [[ "${out}" != *"${info}"* ]] || [[ "${out}" != *"${error}"* ]]; then
echo "OCP-77520: Command \"oc adm upgrade recommend --version 4.999.999\" should output \"${info}\" and \"${error}\", but actualy not: \"${out}\""
return 1
fi
return 0
}

# Monitor the upgrade status
function check_upgrade_status() {
local wait_upgrade="${TIMEOUT}" interval=1 out avail progress cluster_version stat_cmd stat='empty' oldstat='empty' filter='[0-9]+h|[0-9]+m|[0-9]+s|[0-9]+%|[0-9]+.[0-9]+s|[0-9]+ of|\s+|\n' start_time end_time
Expand Down Expand Up @@ -378,6 +409,9 @@ function check_upgrade_status() {
echo -e "Eclipsed Time: $(( ($end_time - $start_time) / 60 ))m\n"
return 0
fi
if ! check_upgrade_recommend_when_upgrade_inprogress; then
echo "OCP-77520: failed"
fi
if [[ "${UPGRADE_RHEL_WORKER_BEFOREHAND}" == "true" && ${avail} == "True" && ${progress} == "True" && ${out} == *"Unable to apply ${cluster_version}"* ]]; then
UPGRADE_RHEL_WORKER_BEFOREHAND="triggered"
echo -e "Upgrade stuck at updating RHEL worker, need to run the RHEL worker upgrade later...\n\n"
Expand Down