Skip to content
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
2 changes: 2 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ Scenarios utilize following distinct MicroShift sources:
branch cut, before first EC is released, it will be skipped.
- `lrel`: latest available release (EC, RC or zstream) available from internal
Red Hat repositories (staging).
- `zprel`: z-previous release: latest z-stream release available in rhocp repository.

| Starting ref | End ref | Successful upgrade scenario | Failed upgrade scenario |
|--------------|---------|-----------------------------|-------------------------|
Expand All @@ -591,6 +592,7 @@ Scenarios utilize following distinct MicroShift sources:
| `src` | `src` | **MISSING** | `el92-src@upgrade-failing-cannot-backup.sh` |
| `crel` | `src` | `el92-crel@upgrade-ok.sh` | `el92-crel@upgrade-fails.sh` |
| `y1` | `lrel` | `el96-y1@el96-lrel@standard1.sh` | **MISSING** |
| `zprel` | `lrel` | `el96-zprel@el96-lrel@rpm-upgrade.sh` | **MISSING** |

#### scenario_create_vms

Expand Down
20 changes: 20 additions & 0 deletions test/bin/scenario.sh
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,26 @@ exit_if_image_not_set() {
fi
}

# Exit the script if microshift previous Z-stream version does not exist in rhocp repository
exit_if_zprel_not_exist() {
local -r rhocp_repo="rhocp-4.${MINOR_VERSION}-for-rhel-9-${UNAME_M}-rpms"
local microshift_zprel
if ! microshift_zprel="$(dnf repoquery -q --repo "${rhocp_repo}" --latest-limit 1 --nvr microshift 2>&1)"; then
record_junit "repo ${rhocp_repo} does not exist or is not available: ${microshift_zprel}" "exit_if_zprel_not_exist" "SKIPPED"
exit 0
fi
# check if there are any microshift packages found
if [[ -z ${microshift_zprel} ]]; then
record_junit "no microshift packages found in ${rhocp_repo} repo" "exit_if_zprel_not_exist" "SKIPPED"
exit 0
fi
# check if the microshift package is the same as the target version
if [[ "${microshift_zprel}" == "microshift-${BREW_LREL_RELEASE_VERSION}" ]]; then
record_junit "microshift packages found in ${rhocp_repo} repo ${microshift_zprel} is the same as the target version: ${BREW_LREL_RELEASE_VERSION}" "exit_if_zprel_not_exist" "SKIPPED"
exit 0
fi
}

# Show the IP address of the VM
function get_vm_ip {
local -r vmname="${1}"
Expand Down
56 changes: 56 additions & 0 deletions test/scenarios/releases/el96-zprel@el96-lrel@rpm-upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

# Sourced from scenario.sh and uses functions defined there.

# The RPM-based image used to create the VM for this test does not
# include MicroShift or greenboot, so tell the framework not to wait
# for greenboot to finish when creating the VM.
export SKIP_GREENBOOT=true

# NOTE: Unlike most suites, these tests rely on being run IN ORDER to
# ensure the host is in a good state at the start of each test. We
# could have separated them and run them as separate scenarios, but
# did not want to spend the resources on a new VM.
export TEST_RANDOMIZATION=none

scenario_create_vms() {
exit_if_zprel_not_exist

prepare_kickstart host1 kickstart-liveimg.ks.template ""
launch_vm

# Open the firewall ports. Other scenarios get this behavior by
# embedding settings in the blueprint, but there is no blueprint
# for this scenario. We need do this step before running the RF
# suite so that suite can assume it can reach all of the same
# ports as for any other test.
configure_vm_firewall host1

# Register the host with subscription manager so we can install
# dependencies.
subscription_manager_register host1
}

scenario_remove_vms() {
exit_if_zprel_not_exist

remove_vm host1
}

scenario_run_tests() {
exit_if_zprel_not_exist

# Enable the rhocp repo for the current minor version to install previous Z-stream version
run_command_on_vm host1 "sudo subscription-manager repos --enable fast-datapath-for-rhel-9-\$(uname -m)-rpms"
run_command_on_vm host1 "sudo subscription-manager repos --enable rhocp-4.${MINOR_VERSION}-for-rhel-9-\$(uname -m)-rpms"

local -r reponame=$(basename "${BREW_REPO}")
local -r repo_url="${WEB_SERVER_URL}/rpm-repos/${reponame}"

run_tests host1 \
--exitonfailure \
--variable "SOURCE_REPO_URL:${repo_url}" \
--variable "TARGET_VERSION:${BREW_LREL_RELEASE_VERSION}" \
--variable "PREVIOUS_MINOR_VERSION:${MINOR_VERSION}" \
suites/rpm/upgrade-successful.robot
}
3 changes: 2 additions & 1 deletion test/scenarios/releases/el96@rpm-standard1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@ scenario_run_tests() {
--variable "TARGET_VERSION:${BREW_LREL_RELEASE_VERSION}" \
--variable "EXPECTED_OS_VERSION:9.6" \
suites/rpm/install.robot \
suites/standard1/
suites/standard1/ \
suites/rpm/remove.robot
}
3 changes: 2 additions & 1 deletion test/scenarios/releases/el96@rpm-standard2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,6 @@ scenario_run_tests() {
--variable "TARGET_VERSION:${BREW_LREL_RELEASE_VERSION}" \
--variable "EXPECTED_OS_VERSION:9.6" \
suites/rpm/install.robot \
suites/standard2/
suites/standard2/ \
suites/rpm/remove.robot
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ EOF

scenario_create_vms() {
prepare_kickstart host1 kickstart-liveimg.ks.template ""
launch_vm
launch_vm

# Open the firewall ports. Other scenarios get this behavior by
# embedding settings in the blueprint, but there is no blueprint
Expand Down Expand Up @@ -111,7 +111,5 @@ scenario_run_tests() {
--variable "SOURCE_REPO_URL:${repo_url}" \
--variable "TARGET_VERSION:${BREW_LREL_RELEASE_VERSION}" \
--variable "PREVIOUS_MINOR_VERSION:${PREVIOUS_MINOR_VERSION}" \
suites/rpm/install.robot \
suites/rpm/remove.robot \
suites/rpm/upgrade-successful.robot
}
4 changes: 4 additions & 0 deletions test/suites/rpm/upgrade-successful.robot
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Upgrade From Previous Version
... check_warnings=False
# Verify the package version is as expected
${version}= MicroShift Version
Log MicroShift init version: ${version}
Should Be Equal As Integers ${version.minor} ${PREVIOUS_MINOR_VERSION}
# Start the service and wait until initialized
Start MicroShift
Expand All @@ -68,6 +69,9 @@ Upgrade From Previous Version
Verify Service Active Timestamps
... ${cts1} ${mts1}
... ${cts2} ${mts2}
# Log MicroShift Version
${version}= MicroShift Version
Log MicroShift final version: ${version}
# Restart the host to verify a clean start
Reboot MicroShift Host
# Health of the system is implicitly checked by greenboot successful exit
Expand Down