Ignore DrAgentAssociationError in test_remove_add_speaker_agent

The BGP service plugin will automatically re-schedule BGP speakers
that are unscheduled with a periodic job. This introduces a race
condition that the basic scenario test job needs to account for. This
change causes the test_remove_add_speaker_agent() test to ignore
any DrAgentAssociationError when attempting to explicitly reschedule
a BGP speaker that has just unscheduled. Since the content of the
test is not affected by catching and ignoring these errors, we can
safely ignore the error while enabling the test to pass consistently.

Change-Id: I10b11ae52b36552d448cecaea03cfa1baaca026a
Closes-Bug: #1820293
This commit is contained in:
Ryan Tidwell 2019-03-15 10:49:06 -05:00
parent c27bb1f190
commit efaf23a962
1 changed files with 13 additions and 1 deletions

View File

@ -16,6 +16,7 @@
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions as t_exc
from neutron_dynamic_routing.tests.tempest.scenario import base as s_base
from neutron_dynamic_routing.tests.tempest.scenario.basic import base
@ -100,6 +101,17 @@ class BgpSpeakerBasicTest(base.BgpSpeakerBasicTestJSONBase):
self.check_remote_as_state(self.dr, self.r_ass[0],
ctn_base.BGP_FSM_ACTIVE,
init_state=ctn_base.BGP_FSM_ESTABLISHED)
self.bgp_client.add_bgp_speaker_to_dragent(agent_id, speaker_id)
try:
self.bgp_client.add_bgp_speaker_to_dragent(agent_id, speaker_id)
except t_exc.Conflict:
# Ignore this error because the bgpspeaker may have been
# re-scheduled automatically between now and the last call to
# self.bgp_client.remove_bgp_speaker_from_dragent(). The call
# to check_remote_as_state() will properly assert whether the
# bgpspeaker was scheduled appropriately regardless of whether
# an exception is encountered here.
pass
self.check_remote_as_state(self.dr, self.r_ass[0],
ctn_base.BGP_FSM_ESTABLISHED)