Add more debug information TestNeutronServer
The test cases implemented calling "_test_restart_service_on_sighup", mock the service "start" function. This function appends a temporary file and this file is read by the main to check the correctness of the service and workers executing. In case of failure waiting for the file to be created and populated, the main function will report now: - If the file was not created. - The current size of the file, compared to the expected one (the number of times the "start" function was called) The polling time to check the status of the file was increased to 1 second. Change-Id: I68452408920ad9a1ee7252dd9012f898ddfa7e09 Related-Bug: #1833279
This commit is contained in:
parent
a832a1d1b3
commit
2ffde257cf
|
@ -150,13 +150,20 @@ class TestNeutronServer(base.BaseLoggingTestCase):
|
|||
os.stat(self.temp_file).st_size ==
|
||||
expected_size)
|
||||
|
||||
utils.wait_until_true(
|
||||
condition, timeout=5, sleep=0.1,
|
||||
exception=RuntimeError(
|
||||
"Timed out waiting for file %(filename)s to be created and "
|
||||
"its size become equal to %(size)s." %
|
||||
{'filename': self.temp_file,
|
||||
'size': expected_size}))
|
||||
try:
|
||||
utils.wait_until_true(condition, timeout=5, sleep=1)
|
||||
except utils.TimerTimeout:
|
||||
if not os.path.isfile(self.temp_file):
|
||||
raise RuntimeError(
|
||||
"Timed out waiting for file %(filename)s to be created" %
|
||||
{'filename': self.temp_file})
|
||||
else:
|
||||
raise RuntimeError(
|
||||
"Expected size for file %(filename)s: %(size)s, current "
|
||||
"size: %(current_size)s" %
|
||||
{'filename': self.temp_file,
|
||||
'size': expected_size,
|
||||
'current_size': os.stat(self.temp_file).st_size})
|
||||
|
||||
# Verify that start has been called twice for each worker (one for
|
||||
# initial start, and the second one on SIGHUP after children were
|
||||
|
|
Loading…
Reference in New Issue