@@ -1215,12 +1215,17 @@ def test_fresh_install(ws, mock_installation):
12151215
12161216
12171217def test_get_existing_installation_global (ws , mock_installation , mocker ):
1218- mocker .patch ("webbrowser.open" )
1219- prompts = MockPrompts (
1218+ base_prompts = MockPrompts (
12201219 {
12211220 r".*PRO or SERVERLESS SQL warehouse.*" : "1" ,
12221221 r"Choose how to map the workspace groups.*" : "2" ,
12231222 r"Open config file in.*" : "no" ,
1223+ r".*" : "" ,
1224+ }
1225+ )
1226+
1227+ first_prompts = base_prompts .extend (
1228+ {
12241229 r"Inventory Database stored in hive_metastore.*" : "ucx_global" ,
12251230 r".*" : "" ,
12261231 }
@@ -1238,42 +1243,48 @@ def test_get_existing_installation_global(ws, mock_installation, mocker):
12381243 }
12391244 )
12401245
1241- first_install = WorkspaceInstaller (prompts , installation , ws , PRODUCT_INFO )
1246+ first_install = WorkspaceInstaller (first_prompts , installation , ws , PRODUCT_INFO )
12421247 workspace_config = first_install .configure ()
12431248 assert workspace_config .inventory_database == 'ucx_global'
12441249
12451250 force_user_environ = {'UCX_FORCE_INSTALL' : 'user' }
12461251
1252+ second_prompts = base_prompts .extend (
1253+ {
1254+ r".*UCX is already installed on this workspace.*" : "no" ,
1255+ }
1256+ )
12471257 # test for force user install variable without prompts
1248- second_install = WorkspaceInstaller (prompts , installation , ws , PRODUCT_INFO , force_user_environ )
1258+ second_install = WorkspaceInstaller (second_prompts , installation , ws , PRODUCT_INFO , force_user_environ )
12491259 with pytest .raises (RuntimeWarning , match = 'UCX is already installed, but no confirmation' ):
12501260 second_install .configure ()
12511261
12521262 # test for force user install variable with prompts
1253- prompts = MockPrompts (
1263+ third_prompts = base_prompts . extend (
12541264 {
1255- r".*PRO or SERVERLESS SQL warehouse.*" : "1" ,
1256- r"Choose how to map the workspace groups.*" : "2" ,
1257- r".*workspace group names.*" : "g1, g2, g99" ,
1258- r"Open config file in.*" : "yes" ,
12591265 r".*UCX is already installed on this workspace.*" : "yes" ,
12601266 r"Inventory Database stored in hive_metastore.*" : "ucx_user" ,
1261- r".*" : "" ,
12621267 }
12631268 )
1264- third_install = WorkspaceInstaller (prompts , installation , ws , PRODUCT_INFO , force_user_environ )
1269+ third_install = WorkspaceInstaller (third_prompts , installation , ws , PRODUCT_INFO , force_user_environ )
12651270 workspace_config = third_install .configure ()
12661271 assert workspace_config .inventory_database == 'ucx_user'
12671272
12681273
12691274def test_existing_installation_user (ws , mock_installation ):
12701275 # test configure on existing user install
1271- prompts = MockPrompts (
1276+ base_prompts = MockPrompts (
12721277 {
12731278 r".*PRO or SERVERLESS SQL warehouse.*" : "1" ,
12741279 r"Choose how to map the workspace groups.*" : "2" ,
12751280 r".*workspace group names.*" : "g1, g2, g99" ,
1276- r"Open config file in.*" : "yes" ,
1281+ r"Open config file in.*" : "no" ,
1282+ r".*" : "" ,
1283+ }
1284+ )
1285+
1286+ first_prompts = base_prompts .extend (
1287+ {
12771288 r".*UCX is already installed on this workspace.*" : "yes" ,
12781289 r"Inventory Database stored in hive_metastore.*" : "ucx_user" ,
12791290 r".*" : "" ,
@@ -1292,41 +1303,33 @@ def test_existing_installation_user(ws, mock_installation):
12921303 },
12931304 is_global = False ,
12941305 )
1295- first_install = WorkspaceInstaller (prompts , installation , ws , PRODUCT_INFO )
1306+ first_install = WorkspaceInstaller (first_prompts , installation , ws , PRODUCT_INFO )
12961307 workspace_config = first_install .configure ()
12971308 assert workspace_config .inventory_database == 'ucx_user'
12981309
12991310 # test for force global install variable without prompts
13001311 # resetting prompts to remove confirmation
1301- prompts = MockPrompts (
1312+ second_prompts = base_prompts . extend (
13021313 {
1303- r".*PRO or SERVERLESS SQL warehouse.*" : "1" ,
1304- r"Choose how to map the workspace groups.*" : "2" ,
1305- r".*workspace group names.*" : "g1, g2, g99" ,
1306- r"Open config file in.*" : "yes" ,
1307- r".*" : "" ,
1314+ r".*UCX is already installed on this workspace.*" : "no" ,
13081315 }
13091316 )
13101317
13111318 force_global_env = {'UCX_FORCE_INSTALL' : 'global' }
1312- second_install = WorkspaceInstaller (prompts , installation , ws , PRODUCT_INFO , force_global_env )
1319+ second_install = WorkspaceInstaller (second_prompts , installation , ws , PRODUCT_INFO , force_global_env )
13131320 with pytest .raises (RuntimeWarning , match = 'UCX is already installed, but no confirmation' ):
13141321 second_install .configure ()
13151322
13161323 # test for force global install variable with prompts
1317- prompts = MockPrompts (
1324+ third_prompts = base_prompts . extend (
13181325 {
1319- r".*PRO or SERVERLESS SQL warehouse.*" : "1" ,
1320- r"Choose how to map the workspace groups.*" : "2" ,
1321- r".*workspace group names.*" : "g1, g2, g99" ,
1322- r"Open config file in.*" : "yes" ,
13231326 r".*UCX is already installed on this workspace.*" : "yes" ,
13241327 r"Inventory Database stored in hive_metastore.*" : "ucx_user_new" ,
13251328 r".*" : "" ,
13261329 }
13271330 )
13281331
1329- third_install = WorkspaceInstaller (prompts , installation , ws , PRODUCT_INFO , force_global_env )
1332+ third_install = WorkspaceInstaller (third_prompts , installation , ws , PRODUCT_INFO , force_global_env )
13301333 with pytest .raises (NotImplemented , match = "Migration needed. Not implemented yet." ):
13311334 third_install .configure ()
13321335
0 commit comments