@@ -2247,8 +2247,11 @@ def test_update_port_postcommit_live_migration_revision_mismatch_once(
22472247 '_is_port_provisioning_required' , lambda * _ : True )
22482248 @mock .patch .object (mech_driver .OVNMechanismDriver , '_notify_dhcp_updated' )
22492249 @mock .patch .object (ovn_client .OVNClient , 'update_port' )
2250- def test_update_port_postcommit_revision_mismatch_not_after_live_migration (
2251- self , mock_update_port , mock_notify_dhcp ):
2250+ def _test_update_port_postcommit_with_exception (
2251+ self , mock_update_port , mock_notify_dhcp ,
2252+ raised_exc ,
2253+ resource_id_name ,
2254+ ** exc_extra_params ):
22522255 self .plugin .update_port_status = mock .Mock ()
22532256 self .plugin .get_port = mock .Mock (return_value = mock .MagicMock ())
22542257
@@ -2266,10 +2269,12 @@ def test_update_port_postcommit_revision_mismatch_not_after_live_migration(
22662269
22672270 fake_ctx = mock .Mock (current = fake_port , original = original_fake_port ,
22682271 _plugin_context = fake_context )
2272+
2273+ exc_params = exc_extra_params .copy ()
2274+ exc_params [resource_id_name ] = fake_port ['id' ]
2275+
22692276 mock_update_port .side_effect = [
2270- ovn_exceptions .RevisionConflict (
2271- resource_id = fake_port ['id' ],
2272- resource_type = ovn_const .TYPE_PORTS ),
2277+ raised_exc (** exc_params ),
22732278 None ]
22742279
22752280 self .mech_driver .update_port_postcommit (fake_ctx )
@@ -2279,6 +2284,20 @@ def test_update_port_postcommit_revision_mismatch_not_after_live_migration(
22792284 self .assertEqual (1 , mock_update_port .call_count )
22802285 mock_notify_dhcp .assert_called_with (fake_port ['id' ])
22812286
2287+ def test_update_port_postcommit_revision_mismatch_not_after_live_migration (
2288+ self ):
2289+ self ._test_update_port_postcommit_with_exception (
2290+ raised_exc = ovn_exceptions .RevisionConflict ,
2291+ resource_id_name = 'resource_id' ,
2292+ resource_type = ovn_const .TYPE_PORTS ,
2293+ )
2294+
2295+ def test__ovn_update_port_missing_stdattribute (self ):
2296+ """Make sure exception is handled."""
2297+ self ._test_update_port_postcommit_with_exception (
2298+ raised_exc = ovn_revision_numbers_db .StandardAttributeIDNotFound ,
2299+ resource_id_name = 'resource_uuid' )
2300+
22822301 def test_agent_alive_true (self ):
22832302 chassis_private = self ._add_chassis (5 )
22842303 for agent_type in (ovn_const .OVN_CONTROLLER_AGENT ,
0 commit comments