1515)
1616from tests .install_upgrade_operators .product_upgrade .utils import (
1717 approve_cnv_upgrade_install_plan ,
18+ build_eus_upgrade_path_dict ,
1819 extract_ocp_version_from_ocp_image ,
1920 get_alerts_fired_during_upgrade ,
2021 get_all_firing_cnv_alerts ,
21- get_iib_images_of_cnv_versions ,
2222 get_nodes_labels ,
2323 get_nodes_taints ,
24- get_shortest_upgrade_path ,
2524 perform_cnv_upgrade ,
2625 run_ocp_upgrade_command ,
2726 set_workload_update_methods_hco ,
4241from utilities .constants import (
4342 HCO_CATALOG_SOURCE ,
4443 TIMEOUT_10MIN ,
44+ TIMEOUT_180MIN ,
4545 NamespacesNames ,
4646)
4747from utilities .data_collector import (
4848 get_data_collector_base_directory ,
4949)
5050from utilities .infra import (
5151 generate_openshift_pull_secret_file ,
52- get_csv_by_name ,
5352 get_prometheus_k8s_token ,
5453 get_related_images_name_and_version ,
5554 get_subscription ,
@@ -324,27 +323,24 @@ def fired_alerts_during_upgrade(
324323
325324
326325@pytest .fixture (scope = "session" )
327- def eus_cnv_upgrade_path (admin_client , eus_target_cnv_version ):
328- if eus_target_cnv_version is None :
326+ def eus_cnv_upgrade_path (
327+ cnv_target_version ,
328+ cnv_current_version ,
329+ cnv_channel ,
330+ cnv_image_url ,
331+ ):
332+ if Version (version = cnv_current_version ).minor % 2 :
329333 exit_pytest_execution (
330- log_message = "EUS upgrade can not be performed from non-eus version" ,
334+ message = f "EUS upgrade can not be performed from non-eus version: { cnv_current_version } " ,
331335 return_code = EUS_ERROR_CODE ,
332336 filename = "eus_upgrade_failure.txt" ,
333- admin_client = admin_client ,
334337 )
335- # Get the shortest path to the target (EUS) version
336- upgrade_path_to_target_version = get_shortest_upgrade_path ( target_version = eus_target_cnv_version )
337- # Get the shortest path to the intermediate (non-EUS) version
338- upgrade_path_to_intermediate_version = get_shortest_upgrade_path (
339- target_version = upgrade_path_to_target_version [ "startVersion" ]
338+ return build_eus_upgrade_path_dict (
339+ current_cnv_version = cnv_current_version ,
340+ target_cnv_version = cnv_target_version ,
341+ target_channel = cnv_channel ,
342+ target_cnv_image_url = cnv_image_url ,
340343 )
341- # Return a dictionary with the versions and images for the EUS-to-EUS upgrade
342- upgrade_path = {
343- "non-eus" : get_iib_images_of_cnv_versions (versions = upgrade_path_to_intermediate_version ["versions" ]),
344- EUS : get_iib_images_of_cnv_versions (versions = upgrade_path_to_target_version ["versions" ], errata_status = "false" ),
345- }
346- LOGGER .info (f"Upgrade path for EUS-to-EUS upgrade: { upgrade_path } " )
347- return upgrade_path
348344
349345
350346@pytest .fixture (scope = "session" )
@@ -376,6 +372,7 @@ def eus_unpaused_worker_mcp(
376372 machine_config_pools_list = worker_machine_config_pools ,
377373 initial_mcp_conditions = worker_machine_config_pools_conditions ,
378374 nodes = workers ,
375+ timeout = TIMEOUT_180MIN ,
379376 )
380377
381378
@@ -493,7 +490,7 @@ def triggered_non_eus_to_target_eus_ocp_upgrade(eus_ocp_image_urls):
493490@pytest .fixture ()
494491def source_eus_to_non_eus_ocp_upgraded (
495492 admin_client ,
496- masters ,
493+ control_plane_nodes ,
497494 master_machine_config_pools ,
498495 ocp_version_eus_to_non_eus_from_image_url ,
499496 triggered_source_eus_to_non_eus_ocp_upgrade ,
@@ -503,14 +500,14 @@ def source_eus_to_non_eus_ocp_upgraded(
503500 machine_config_pools_list = master_machine_config_pools ,
504501 target_ocp_version = ocp_version_eus_to_non_eus_from_image_url ,
505502 initial_mcp_conditions = get_machine_config_pools_conditions (machine_config_pools = master_machine_config_pools ),
506- nodes = masters ,
503+ nodes = control_plane_nodes ,
507504 )
508505
509506
510507@pytest .fixture ()
511508def non_eus_to_target_eus_ocp_upgraded (
512509 admin_client ,
513- masters ,
510+ control_plane_nodes ,
514511 master_machine_config_pools ,
515512 ocp_version_non_eus_to_eus_from_image_url ,
516513 triggered_non_eus_to_target_eus_ocp_upgrade ,
@@ -520,7 +517,7 @@ def non_eus_to_target_eus_ocp_upgraded(
520517 machine_config_pools_list = master_machine_config_pools ,
521518 target_ocp_version = ocp_version_non_eus_to_eus_from_image_url ,
522519 initial_mcp_conditions = get_machine_config_pools_conditions (machine_config_pools = master_machine_config_pools ),
523- nodes = masters ,
520+ nodes = control_plane_nodes ,
524521 )
525522
526523
@@ -529,17 +526,25 @@ def source_eus_to_non_eus_cnv_upgraded(
529526 admin_client ,
530527 hco_namespace ,
531528 eus_cnv_upgrade_path ,
529+ cnv_subscription_scope_session ,
530+ cnv_registry_source ,
532531 hyperconverged_resource_scope_function ,
533- updated_cnv_subscription_source ,
534532):
535- for version , cnv_image in sorted (eus_cnv_upgrade_path ["non-eus" ].items ()):
533+ for version , build_info in sorted (
534+ eus_cnv_upgrade_path ["non-eus" ].items (),
535+ key = lambda item : Version (version = item [0 ]),
536+ ):
537+ cnv_image = build_info ["cnv_image_url" ]
536538 LOGGER .info (f"Cnv upgrade to version { version } using image: { cnv_image } " )
537539 perform_cnv_upgrade (
538540 admin_client = admin_client ,
539541 cnv_image_url = cnv_image ,
540542 cr_name = hyperconverged_resource_scope_function .name ,
541543 hco_namespace = hco_namespace ,
542- cnv_target_version = version .lstrip ("v" ),
544+ cnv_target_version = version ,
545+ subscription = cnv_subscription_scope_session ,
546+ subscription_source = cnv_registry_source ["cnv_subscription_source" ],
547+ subscription_channel = build_info ["channel" ],
543548 )
544549 LOGGER .info ("Successfully performed cnv upgrades from source EUS to non-EUS version." )
545550
@@ -549,27 +554,27 @@ def non_eus_to_target_eus_cnv_upgraded(
549554 admin_client ,
550555 hco_namespace ,
551556 eus_cnv_upgrade_path ,
557+ cnv_subscription_scope_session ,
558+ cnv_registry_source ,
552559 hyperconverged_resource_scope_function ,
553- updated_cnv_subscription_source ,
554560):
555- version , cnv_image = next (iter (eus_cnv_upgrade_path [EUS ].items ()))
556- LOGGER .info (f"Cnv upgrade to version { version } using image: { cnv_image } " )
557- perform_cnv_upgrade (
558- admin_client = admin_client ,
559- cnv_image_url = cnv_image ,
560- cr_name = hyperconverged_resource_scope_function .name ,
561- hco_namespace = hco_namespace ,
562- cnv_target_version = version .lstrip ("v" ),
563- )
564-
565-
566- @pytest .fixture ()
567- def eus_created_target_hco_csv (admin_client , hco_namespace , eus_hco_target_csv_name ):
568- return get_csv_by_name (
569- csv_name = eus_hco_target_csv_name ,
570- admin_client = admin_client ,
571- namespace = hco_namespace .name ,
572- )
561+ for version , build_info in sorted (
562+ eus_cnv_upgrade_path [EUS ].items (),
563+ key = lambda item : Version (version = item [0 ]),
564+ ):
565+ cnv_image = build_info ["cnv_image_url" ]
566+ LOGGER .info (f"Cnv upgrade to version { version } using image: { cnv_image } " )
567+ perform_cnv_upgrade (
568+ admin_client = admin_client ,
569+ cnv_image_url = cnv_image ,
570+ cr_name = hyperconverged_resource_scope_function .name ,
571+ hco_namespace = hco_namespace ,
572+ cnv_target_version = version ,
573+ subscription = cnv_subscription_scope_session ,
574+ subscription_source = cnv_registry_source ["cnv_subscription_source" ],
575+ subscription_channel = build_info ["channel" ],
576+ )
577+ LOGGER .info ("Successfully performed cnv upgrades from non-EUS to target EUS version." )
573578
574579
575580@pytest .fixture ()
0 commit comments