Wait until child process will be killed
It might take a wile to kill worker after receiving of sighup because of worker can be busy at the time, so the check of the workers count can be failed during some amount of time. Add timeout for checking. Change-Id: Ibdd29b07960b2f765b03ea9458b6e85cd6786fd0 Closes-bug: #1472531
This commit is contained in:
parent
cf8f36c44b
commit
205fe94b87
@ -109,6 +109,10 @@ IntegrationTestGroup = [
|
|||||||
default=120,
|
default=120,
|
||||||
help="Timeout in seconds to wait for connectivity to "
|
help="Timeout in seconds to wait for connectivity to "
|
||||||
"server."),
|
"server."),
|
||||||
|
cfg.IntOpt('sighup_timeout',
|
||||||
|
default=30,
|
||||||
|
help="Timeout in seconds to wait for adding or removing child"
|
||||||
|
"process after receiving of sighup signal")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
|
|
||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
@ -67,11 +69,18 @@ class ReloadOnSighupTest(test.HeatIntegrationTest):
|
|||||||
self._set_config_value(service, 'workers', new_workers)
|
self._set_config_value(service, 'workers', new_workers)
|
||||||
cmd = "kill -HUP %s" % pre_reload_parent
|
cmd = "kill -HUP %s" % pre_reload_parent
|
||||||
processutils.execute(cmd, shell=True)
|
processutils.execute(cmd, shell=True)
|
||||||
# wait till heat-api reloads
|
|
||||||
eventlet.sleep(2)
|
|
||||||
|
|
||||||
post_reload_parent, post_reload_children = self._get_heat_api_pids(
|
# wait till heat-api reloads
|
||||||
service)
|
start_time = time.time()
|
||||||
|
while time.time() - start_time < self.conf.sighup_timeout:
|
||||||
|
post_reload_parent, post_reload_children = self._get_heat_api_pids(
|
||||||
|
service)
|
||||||
|
intersect = set(post_reload_children) & set(pre_reload_children)
|
||||||
|
if (new_workers == len(post_reload_children)
|
||||||
|
and pre_reload_parent == post_reload_parent
|
||||||
|
and intersect == set()):
|
||||||
|
break
|
||||||
|
eventlet.sleep(1)
|
||||||
self.assertEqual(pre_reload_parent, post_reload_parent)
|
self.assertEqual(pre_reload_parent, post_reload_parent)
|
||||||
self.assertEqual(new_workers, len(post_reload_children))
|
self.assertEqual(new_workers, len(post_reload_children))
|
||||||
# test if all child processes are newly created
|
# test if all child processes are newly created
|
||||||
|
Loading…
Reference in New Issue
Block a user