Fix functional test_server tests
Now oslo.service 0.10.0 no longer sends SIGHUP to parent and children services. This was a chance introduced by 286a6ea, and since it invalidated the very logic under test, this must be revised. Change-Id: I18a11283925369bc918002477774f196010a1bc3 Closes-bug: #1505438
This commit is contained in:
parent
3da8a28315
commit
090fe71359
|
@ -130,16 +130,14 @@ class TestNeutronServer(base.BaseTestCase):
|
||||||
1. Start a service with a given number of workers.
|
1. Start a service with a given number of workers.
|
||||||
2. Send SIGHUP to the service.
|
2. Send SIGHUP to the service.
|
||||||
3. Wait for workers (if any) to restart.
|
3. Wait for workers (if any) to restart.
|
||||||
4. Assert that the pids of the workers didn't change after restart.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
start_workers = self._start_server(callback=service, workers=workers)
|
self._start_server(callback=service, workers=workers)
|
||||||
|
|
||||||
os.kill(self.service_pid, signal.SIGHUP)
|
os.kill(self.service_pid, signal.SIGHUP)
|
||||||
|
|
||||||
# Wait for temp file to be created and its size become equal
|
# Wait for temp file to be created and its size become equal
|
||||||
# to size of FAKE_RESET_MSG repeated (workers + 1) times.
|
# to size of FAKE_RESET_MSG
|
||||||
expected_size = len(FAKE_RESET_MSG) * (workers + 1)
|
expected_size = len(FAKE_RESET_MSG)
|
||||||
condition = lambda: (os.path.isfile(self.temp_file)
|
condition = lambda: (os.path.isfile(self.temp_file)
|
||||||
and os.stat(self.temp_file).st_size ==
|
and os.stat(self.temp_file).st_size ==
|
||||||
expected_size)
|
expected_size)
|
||||||
|
@ -153,15 +151,11 @@ class TestNeutronServer(base.BaseTestCase):
|
||||||
'size': expected_size}))
|
'size': expected_size}))
|
||||||
|
|
||||||
# Verify that reset has been called for parent process in which
|
# Verify that reset has been called for parent process in which
|
||||||
# a service was started and for each worker by checking that
|
# a service was started. FAKE_RESET_MSG has been written to temp
|
||||||
# FAKE_RESET_MSG has been written to temp file workers + 1 times.
|
# file.
|
||||||
with open(self.temp_file, 'r') as f:
|
with open(self.temp_file, 'r') as f:
|
||||||
res = f.readline()
|
res = f.readline()
|
||||||
self.assertEqual(FAKE_RESET_MSG * (workers + 1), res)
|
self.assertEqual(FAKE_RESET_MSG, res)
|
||||||
|
|
||||||
# Make sure worker pids don't change
|
|
||||||
end_workers = self._get_workers()
|
|
||||||
self.assertEqual(start_workers, end_workers)
|
|
||||||
|
|
||||||
|
|
||||||
class TestWsgiServer(TestNeutronServer):
|
class TestWsgiServer(TestNeutronServer):
|
||||||
|
|
Loading…
Reference in New Issue