diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2018-01-16 12:57:55 +0900 |
---|---|---|
committer | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2018-01-19 13:28:26 +0900 |
commit | be7e6206bc3706214a0aab762ca1af4a782ad27c (patch) | |
tree | 540395b16468a37b95faf18b7a9e095f4530d05f /test/lib/bird.py | |
parent | 4c51cdedf75158e01e6ea4c621abb42f0d896235 (diff) |
test/lib/{bird,gobgp,quagga,yabgp}: Wait for daemon boot
Currently, scenario test library does not wait for the daemons boot in
containers at starting up or after sending SIGHUP for reloading new
configurations.
So some test cases (e.g., graceful_restart_test.py) fails occasionally
to insert static routes into GoBGP after reloading new configurations.
This patch fixes to wait for the daemons boot and improves the stability
of scenario tests.
Note: This patch does not introduce these improvements to
BagpipeContainer and ExaBGPContainer, because;
- Docker image for BaGPipe, which used in scenario test library, is too
old and BagpipeContainer does not seem to be used in the current test
cases.
- The version of ExaBGP in "osrg/exabgp" Docker image has no way to ask
the daemon status other than "ps" command ("ps" is already done, but
not enough). If "exabgpcli" is available on ExaBGP container, which is
required the next release of 4.0.2 or 3.4.21, we can use it to check
whether ExaBGP is started up or not.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'test/lib/bird.py')
-rw-r--r-- | test/lib/bird.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/lib/bird.py b/test/lib/bird.py index 8077760f..1207e335 100644 --- a/test/lib/bird.py +++ b/test/lib/bird.py @@ -25,6 +25,7 @@ from lib.base import ( BGPContainer, CmdBuffer, try_several_times, + wait_for_completion, ) @@ -48,6 +49,13 @@ class BirdContainer(BGPContainer): local(cmd) self.local('{0}/start.sh'.format(self.SHARED_VOLUME)) + def _wait_for_boot(self): + def _f(): + ret = self.local('birdc show status > /dev/null 2>&1; echo $?', capture=True) + return ret == '0' + + return wait_for_completion(_f) + def run(self): super(BirdContainer, self).run() self.reload_config() @@ -81,13 +89,16 @@ class BirdContainer(BGPContainer): if 'bird' in line: running = True return running + if _is_running(): self.local('birdc configure') else: self._start_bird() - time.sleep(1) + + self._wait_for_boot() if not _is_running(): raise RuntimeError() + try_several_times(_reload) |