diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-07-12 19:55:51 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-07-12 19:55:52 +0000 |
commit | e6d24dce95ff596837101d47d541ee47e43992d1 (patch) | |
tree | 39408cc2ffabd43f1258fb0cd34bd0b4f99b2ea4 | |
parent | e69890db54c92d480d579aee170d7ec0136e3ffe (diff) | |
parent | d7a5acf0fbf4fdad07da9a1cef23cd943f5a9230 (diff) | |
download | neutron-e6d24dce95ff596837101d47d541ee47e43992d1.tar.gz |
Merge "Fix keepalived functional tests" into stable/liberty
-rw-r--r-- | neutron/tests/functional/agent/linux/test_keepalived.py | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/neutron/tests/functional/agent/linux/test_keepalived.py b/neutron/tests/functional/agent/linux/test_keepalived.py index aec696f406..a3197cc81e 100644 --- a/neutron/tests/functional/agent/linux/test_keepalived.py +++ b/neutron/tests/functional/agent/linux/test_keepalived.py @@ -42,28 +42,25 @@ class KeepalivedManagerTestCase(base.BaseTestCase, conf_path=cfg.CONF.state_path) self.addCleanup(self.manager.disable) + def _spawn_keepalived(self, keepalived_manager): + keepalived_manager.spawn() + process = keepalived_manager.get_process() + utils.wait_until_true( + lambda: process.active, + timeout=5, + sleep=0.01, + exception=RuntimeError(_("Keepalived didn't spawn"))) + return process + def test_keepalived_spawn(self): - self.manager.spawn() - process = external_process.ProcessManager( - cfg.CONF, - 'router1', - namespace=None, - pids_path=cfg.CONF.state_path) - self.assertTrue(process.active) + self._spawn_keepalived(self.manager) self.assertEqual(self.expected_config.get_config_str(), self.manager.get_conf_on_disk()) def _test_keepalived_respawns(self, normal_exit=True): - self.manager.spawn() - process = self.manager.get_process() + process = self._spawn_keepalived(self.manager) pid = process.pid - utils.wait_until_true( - lambda: process.active, - timeout=5, - sleep=0.01, - exception=RuntimeError(_("Keepalived didn't spawn"))) - exit_code = '-15' if normal_exit else '-9' # Exit the process, and see that when it comes back @@ -92,12 +89,7 @@ class KeepalivedManagerTestCase(base.BaseTestCase, with open(pid_file, "w") as f_pid_file: f_pid_file.write("%s" % spawn_process.pid) - self.manager.spawn() - utils.wait_until_true( - lambda: process.active, - timeout=5, - sleep=0.1, - exception=RuntimeError(_("Keepalived didn't spawn"))) + self._spawn_keepalived(self.manager) def test_keepalived_spawns_conflicting_pid_base_process(self): process = self.manager.get_process() |