Enhance agent's resources_synced check

The fullstack test TestPlacementBandwidthReport.
test_configurations_are_synced_towards_placement sporadically failing
and one possible reason is that multiple agents are visible to the
server after restart of the agent (perhaps due to parallel execution).

Partial-Bug: #1862177
Change-Id: I79aa2cb9bcd69fc0cb35e0fd351a373e00feb062
This commit is contained in:
elajkat 2020-02-07 13:41:28 +01:00
parent d5b33ffc77
commit c9a3d49513
1 changed files with 9 additions and 4 deletions

View File

@ -215,9 +215,10 @@ class TestPlacementBandwidthReport(base.BaseFullStackTestCase):
return not self._check_agent_synced()
def _check_agent_synced(self):
agents = self.client.list_agents()
if (len(agents['agents']) == 1 and
agents['agents'][0]['resources_synced']):
agents = self.client.list_agents(agent_type=self.l2_agent_type)
for agent in agents['agents']:
if (agent['id'] == self.original_agent_id and
agent['resources_synced']):
return True
return False
@ -225,6 +226,10 @@ class TestPlacementBandwidthReport(base.BaseFullStackTestCase):
neutron_config = self.environment.hosts[0].l2_agent.neutron_config
report_interval = int(neutron_config['agent']['report_interval'])
agents = self.client.list_agents(agent_type=self.l2_agent_type)
self.assertEqual(1, len(agents['agents']))
self.original_agent_id = agents['agents'][0]['id']
check_agent_synced = functools.partial(self._check_agent_synced)
utils.wait_until_true(
predicate=check_agent_synced,