Skip to content

Commit 54501e7

Browse files
elajkatkatonalala
authored andcommitted
Fullstack: Wait placement process fixtrue to really stop
It seems that in test test_configurations_are_synced_towards_placement when the fake placement process is stopped it can take longer and the test restarts the agent before it is really dead. In this case neutron-server can report the status and the agent's 'resources_synced' field is True when the tests checks it. A simple workaround for this can be to check if the AsyncProcess class' _is_running property is False. Closes-Bug: #1856319 Change-Id: Ia4c25110ee5a7b7539407d3531f559555fec50cc (cherry picked from commit 0ae432e) (cherry picked from commit 4d983d2)
1 parent a70cfff commit 54501e7

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

neutron/agent/common/async_process.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ def __init__(self, cmd, run_as_root=False, respawn_interval=None,
9595
def cmd(self):
9696
return ' '.join(self._cmd)
9797

98+
@property
99+
def is_running(self):
100+
return self._is_running
101+
98102
def _reset_queues(self):
99103
self._stdout_lines = eventlet.queue.LightQueue()
100104
self._stderr_lines = eventlet.queue.LightQueue()

neutron/tests/fullstack/resources/process.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ def _restart():
9898
else:
9999
return executor.submit(_restart)
100100

101+
def process_is_running(self):
102+
return self.process.is_running
103+
104+
def process_is_not_running(self):
105+
return not self.process_is_running()
106+
101107

102108
class RabbitmqEnvironmentFixture(fixtures.Fixture):
103109

neutron/tests/fullstack/test_agent_bandwidth_report.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,14 @@ def test_configurations_are_synced_towards_placement(self):
237237
sleep=1)
238238

239239
self.environment.placement.process_fixture.stop()
240+
241+
placement_fixture = self.environment.placement.process_fixture
242+
utils.wait_until_true(
243+
predicate=functools.partial(
244+
placement_fixture.process_is_not_running),
245+
timeout=report_interval, sleep=1
246+
)
247+
240248
_add_new_bridge_and_restart_agent(self.environment.hosts[0])
241249

242250
check_agent_not_synced = functools.partial(

0 commit comments

Comments
 (0)