@@ -129,9 +129,24 @@ def test_installation_recreates_trashed_lakeview_dashboard(caplog, ws, workspace
129
129
[MockInstallation ({'state.json' : {'resources' : {'dashboards' : {"assessment_main" : "lakeview_id" }}}})],
130
130
indirect = True ,
131
131
)
132
- @pytest .mark .parametrize ("exception" , [InvalidParameterValue , NotFound ])
133
- def test_installation_recovers_invalid_dashboard (caplog , ws , workspace_installation , exception ):
134
- ws .lakeview .get .side_effect = exception
132
+ def test_installation_recovers_invalid_dashboard_invalidparametervalue (caplog , ws , workspace_installation ):
133
+ ws .lakeview .get .side_effect = InvalidParameterValue
134
+ with caplog .at_level (logging .DEBUG , logger = "databricks.labs.ucx.install" ):
135
+ workspace_installation .run ()
136
+ assert "Recovering invalid dashboard" in caplog .text
137
+ assert "Deleted dangling dashboard" in caplog .text
138
+ ws .workspace .delete .assert_called ()
139
+ ws .lakeview .create .assert_called ()
140
+ ws .lakeview .update .assert_not_called ()
141
+
142
+
143
+ @pytest .mark .parametrize (
144
+ "workspace_installation" ,
145
+ [MockInstallation ({'state.json' : {'resources' : {'dashboards' : {"assessment_main" : "lakeview_id" }}}})],
146
+ indirect = True ,
147
+ )
148
+ def test_installation_recovers_invalid_dashboard_notfound (caplog , ws , workspace_installation ):
149
+ ws .lakeview .get .side_effect = NotFound
135
150
with caplog .at_level (logging .DEBUG , logger = "databricks.labs.ucx.install" ):
136
151
workspace_installation .run ()
137
152
assert "Recovering invalid dashboard" in caplog .text
0 commit comments