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:
parent
d5b33ffc77
commit
c9a3d49513
@ -215,16 +215,21 @@ 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']):
|
||||
return True
|
||||
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
|
||||
|
||||
def test_configurations_are_synced_towards_placement(self):
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user