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 0ae432e717
)
This commit is contained in:
parent
14907c8fd6
commit
4d983d2fea
|
@ -95,6 +95,10 @@ class AsyncProcess(object):
|
|||
def cmd(self):
|
||||
return ' '.join(self._cmd)
|
||||
|
||||
@property
|
||||
def is_running(self):
|
||||
return self._is_running
|
||||
|
||||
def _reset_queues(self):
|
||||
self._stdout_lines = eventlet.queue.LightQueue()
|
||||
self._stderr_lines = eventlet.queue.LightQueue()
|
||||
|
|
|
@ -98,6 +98,12 @@ class ProcessFixture(fixtures.Fixture):
|
|||
else:
|
||||
return executor.submit(_restart)
|
||||
|
||||
def process_is_running(self):
|
||||
return self.process.is_running
|
||||
|
||||
def process_is_not_running(self):
|
||||
return not self.process_is_running()
|
||||
|
||||
|
||||
class RabbitmqEnvironmentFixture(fixtures.Fixture):
|
||||
|
||||
|
|
|
@ -237,6 +237,14 @@ class TestPlacementBandwidthReport(base.BaseFullStackTestCase):
|
|||
sleep=1)
|
||||
|
||||
self.environment.placement.process_fixture.stop()
|
||||
|
||||
placement_fixture = self.environment.placement.process_fixture
|
||||
utils.wait_until_true(
|
||||
predicate=functools.partial(
|
||||
placement_fixture.process_is_not_running),
|
||||
timeout=report_interval, sleep=1
|
||||
)
|
||||
|
||||
_add_new_bridge_and_restart_agent(self.environment.hosts[0])
|
||||
|
||||
check_agent_not_synced = functools.partial(
|
||||
|
|
Loading…
Reference in New Issue