Skip to content

Commit b2628d6

Browse files
authored
[Gating][Cherry-pick]Fix gating upgrade for non-EUS versions (RedHatQE#1710) (RedHatQE#2735)
Manual cherry-pick of RedHatQE#1710 ##### Short description: * Fix gating upgrade to yield the vms_list Moving the running_vm check and yield vms_list statements outside of the non-gating conditional block, so the vms_for_upgrade fixture will: - Always yield the vms_list containing at least the vm_with_instancetypes_for_upgrade VM. - For non-gating tests, it will create additional VMs from the data sources and add them to the list. This ensures that the vms_for_upgrade fixture always yields a value regardless of whether the test is marked with @pytest.mark.gating or not, resolving the ValueError: vms_for_upgrade did not yield a value error. * Fix gating upgrade for non-EUS versions The gating upgrade test was failing because of an unexpected exit when the testing version is not an EUS version. This fix is returning None instead of exiting allowing the ability to keep testing the CNV upgrade between minor versions. ##### More details: N/A ##### What this PR does / why we need it: N/A ##### Which issue(s) this PR fixes: N/A ##### Special notes for reviewer: N/A ##### jira-ticket: N/A <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Test suites now warn and return a neutral value instead of aborting when an invalid/unsupported version is encountered. * Some upgrade tests will exit early with a clear message when required target versions are missing. * VM upgrade tests always perform startup checks now, altering execution timing. * Test configuration error handling has been reorganized for clearer behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 2b72f6b commit b2628d6

3 files changed

Lines changed: 15 additions & 9 deletions

File tree

tests/conftest.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@
227227
"accessTokenInactivityTimeout": None,
228228
}
229229
CNV_NOT_INSTALLED = "CNV not yet installed."
230-
EUS_ERROR_CODE = 98
231230
RWX_FS_STORAGE_CLASS_NAMES_LIST = [
232231
StorageClassNames.CEPHFS,
233232
StorageClassNames.TRIDENT_CSI_FSX,
@@ -1906,6 +1905,9 @@ def hco_target_csv_name(cnv_target_version):
19061905

19071906
@pytest.fixture(scope="session")
19081907
def eus_hco_target_csv_name(eus_target_cnv_version):
1908+
if eus_target_cnv_version is None:
1909+
LOGGER.warning("Cannot determine EUS HCO target CSV name: EUS target version is None (non-EUS version)")
1910+
return None
19091911
return get_hco_csv_name_by_version(cnv_target_version=eus_target_cnv_version)
19101912

19111913

@@ -1918,12 +1920,10 @@ def cnv_target_version(pytestconfig):
19181920
def eus_target_cnv_version(pytestconfig, cnv_current_version):
19191921
cnv_current_version = Version(version=cnv_current_version)
19201922
minor = cnv_current_version.minor
1921-
# EUS-to-EUS upgrades are only viable between even-numbered minor versions, exit if non-eus version
1923+
# EUS-to-EUS upgrades are only viable between even-numbered minor versions, return None if non-eus version
19221924
if minor % 2:
1923-
exit_pytest_execution(
1924-
message=f"EUS upgrade can not be performed from non-eus version: {cnv_current_version}",
1925-
return_code=EUS_ERROR_CODE,
1926-
)
1925+
LOGGER.warning(f"EUS upgrade can not be performed from non-eus version: {cnv_current_version}")
1926+
return None
19271927
return pytestconfig.option.eus_cnv_target_version or f"{cnv_current_version.major}.{minor + 2}.0"
19281928

19291929

tests/install_upgrade_operators/product_upgrade/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@
5151
update_subscription_source,
5252
wait_for_mcp_update_completion,
5353
)
54+
from utilities.pytest_utils import exit_pytest_execution
5455
from utilities.virt import get_oc_image_info
5556

5657
LOGGER = logging.getLogger(__name__)
5758
POD_STR_NOT_MANAGED_BY_HCO = "hostpath-"
59+
EUS_ERROR_CODE = 98
5860

5961

6062
@pytest.fixture(scope="session")
@@ -318,6 +320,10 @@ def fired_alerts_during_upgrade(fired_alerts_before_upgrade, alert_dir, promethe
318320

319321
@pytest.fixture(scope="session")
320322
def eus_cnv_upgrade_path(eus_target_cnv_version):
323+
if eus_target_cnv_version is None:
324+
exit_pytest_execution(
325+
message="EUS upgrade can not be performed from non-eus version", return_code=EUS_ERROR_CODE
326+
)
321327
# Get the shortest path to the target (EUS) version
322328
upgrade_path_to_target_version = get_shortest_upgrade_path(target_version=eus_target_cnv_version)
323329
# Get the shortest path to the intermediate (non-EUS) version

tests/virt/upgrade/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ def vms_for_upgrade(
9090
vms_list.append(vm)
9191
vm.start(timeout=TIMEOUT_40MIN, wait=False)
9292

93-
for vm in vms_list:
94-
running_vm(vm=vm, wait_for_cloud_init=True)
93+
for vm in vms_list:
94+
running_vm(vm=vm, wait_for_cloud_init=True)
9595

96-
yield vms_list
96+
yield vms_list
9797

9898
finally:
9999
for vm in vms_list:

0 commit comments

Comments
 (0)