@@ -53,7 +53,6 @@ def factory(
5353 if not environ :
5454 environ = {}
5555 renamed_group_prefix = f"rename-{ product_info .product_name ()} -"
56-
5756 prompts = MockPrompts (
5857 {
5958 r'Open job overview in your browser.*' : 'no' ,
@@ -377,6 +376,9 @@ def test_global_installation_on_existing_global_install(ws, new_installation):
377376 reinstall_global , _ = new_installation (
378377 product_info = product_info ,
379378 installation = Installation .assume_global (ws , product_info .product_name ()),
379+ extend_prompts = {
380+ r".*Do you want to update the existing installation?.*" : 'yes' ,
381+ },
380382 )
381383 assert reinstall_global .folder == f"/Applications/{ product_info .product_name ()} "
382384 reinstall_global .uninstall ()
@@ -391,16 +393,16 @@ def test_user_installation_on_existing_global_install(ws, new_installation):
391393 )
392394
393395 # warning to be thrown by installer if override environment variable present but no confirmation
394- with pytest .raises (RuntimeWarning ) as err :
396+ with pytest .raises (RuntimeWarning , match = "UCX is already installed, but no confirmation" ) :
395397 new_installation (
396398 product_info = product_info ,
397399 installation = Installation .assume_global (ws , product_info .product_name ()),
398400 environ = {'UCX_FORCE_INSTALL' : 'user' },
399401 extend_prompts = {
400402 r".*UCX is already installed on this workspace.*" : 'no' ,
403+ r".*Do you want to update the existing installation?.*" : 'yes' ,
401404 },
402405 )
403- assert err .value .args [0 ] == "UCX is already installed, but no confirmation"
404406
405407 # successful override with confirmation
406408 reinstall_user_force , _ = new_installation (
@@ -409,6 +411,7 @@ def test_user_installation_on_existing_global_install(ws, new_installation):
409411 environ = {'UCX_FORCE_INSTALL' : 'user' },
410412 extend_prompts = {
411413 r".*UCX is already installed on this workspace.*" : 'yes' ,
414+ r".*Do you want to update the existing installation?.*" : 'yes' ,
412415 },
413416 inventory_schema_suffix = "_reinstall" ,
414417 )
@@ -428,28 +431,28 @@ def test_global_installation_on_existing_user_install(ws, new_installation):
428431 )
429432
430433 # warning to be thrown by installer if override environment variable present but no confirmation
431- with pytest .raises (RuntimeWarning ) as err :
434+ with pytest .raises (RuntimeWarning , match = "UCX is already installed, but no confirmation" ) :
432435 new_installation (
433436 product_info = product_info ,
434437 installation = Installation .assume_user_home (ws , product_info .product_name ()),
435438 environ = {'UCX_FORCE_INSTALL' : 'global' },
436439 extend_prompts = {
437440 r".*UCX is already installed on this workspace.*" : 'no' ,
441+ r".*Do you want to update the existing installation?.*" : 'yes' ,
438442 },
439443 )
440- assert err .value .args [0 ] == "UCX is already installed, but no confirmation"
441444
442445 # not implemented error with confirmation
443- with pytest .raises (databricks .sdk .errors .NotImplemented ) as err :
446+ with pytest .raises (databricks .sdk .errors .NotImplemented , match = "Migration needed. Not implemented yet." ) :
444447 new_installation (
445448 product_info = product_info ,
446449 installation = Installation .assume_user_home (ws , product_info .product_name ()),
447450 environ = {'UCX_FORCE_INSTALL' : 'global' },
448451 extend_prompts = {
449452 r".*UCX is already installed on this workspace.*" : 'yes' ,
453+ r".*Do you want to update the existing installation?.*" : 'yes' ,
450454 },
451455 )
452- assert err .value .args [0 ] == "Migration needed. Not implemented yet."
453456 existing_user_installation .uninstall ()
454457
455458
@@ -461,16 +464,18 @@ def test_check_inventory_database_exists(ws, new_installation):
461464 )
462465 inventory_database = install .config .inventory_database
463466
464- with pytest .raises (AlreadyExists ) as err :
467+ with pytest .raises (
468+ AlreadyExists , match = f"Inventory database '{ inventory_database } ' already exists in another installation"
469+ ):
465470 new_installation (
466471 product_info = product_info ,
467472 installation = Installation .assume_global (ws , product_info .product_name ()),
468473 environ = {'UCX_FORCE_INSTALL' : 'user' },
469474 extend_prompts = {
470475 r".*UCX is already installed on this workspace.*" : 'yes' ,
476+ r".*Do you want to update the existing installation?.*" : 'yes' ,
471477 },
472478 )
473- assert err .value .args [0 ] == f"Inventory database '{ inventory_database } ' already exists in another installation"
474479
475480
476481@retried (on = [NotFound ], timeout = timedelta (minutes = 10 ))
@@ -616,3 +621,20 @@ def test_partitioned_tables(ws, sql_backend, new_installation, inventory_schema,
616621 assert len (all_tables ) >= 2
617622 assert all_tables [f"{ schema .full_name } .partitioned_table" ].is_partitioned is True
618623 assert all_tables [f"{ schema .full_name } .non_partitioned_table" ].is_partitioned is False
624+
625+
626+ def test_compare_remote_local_install_versions (ws , new_installation ):
627+ product_info = ProductInfo .for_testing (WorkspaceConfig )
628+ new_installation (product_info = product_info )
629+ with pytest .raises (
630+ RuntimeWarning ,
631+ match = "UCX workspace remote and local install versions are same and no override is requested. Exiting..." ,
632+ ):
633+ new_installation (product_info = product_info )
634+
635+ new_installation (
636+ product_info = product_info ,
637+ extend_prompts = {
638+ r".*Do you want to update the existing installation?.*" : 'yes' ,
639+ },
640+ )
0 commit comments