diff options
| author | Alan Conway <aconway@apache.org> | 2014-05-01 22:20:26 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2014-05-01 22:20:26 +0000 |
| commit | e57cd3393b842e40f9da989ab4d60142682ba73e (patch) | |
| tree | 60cca2b0edc4c7aaa9645f8c5a8dd879bff3eb79 /qpid/cpp/src/tests/brokertest.py | |
| parent | 7c0d7cd95d3cbf691e5d0e39be3fe10dce340040 (diff) | |
| download | qpid-python-e57cd3393b842e40f9da989ab4d60142682ba73e.tar.gz | |
NO-JIRA: HA fix hanging ha_tests.test_failover_send_receive on RHEL5
The test was hanging because of a python construct not available in 2.4. It was
causing an exception in a strange place because this bit of code was imported at
runtime, and that was hanging the test. Fixed and did some cleanup
to avoid such mysterious hangs in future:
- Fixed qpidtoollibs/config.py to work with python 2.4.
- Import qpid-ha script at import time rather than runtime.
- Fix Popen.teardown logic to avoid hanging if a process can't be killed.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1591794 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/brokertest.py')
| -rw-r--r-- | qpid/cpp/src/tests/brokertest.py | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/qpid/cpp/src/tests/brokertest.py b/qpid/cpp/src/tests/brokertest.py index ebb1702a05..9d77baebaf 100644 --- a/qpid/cpp/src/tests/brokertest.py +++ b/qpid/cpp/src/tests/brokertest.py @@ -178,29 +178,27 @@ class Popen(subprocess.Popen): raise BadProcessStatus("%s %s%s" % (self.pname, msg, err)) def teardown(self): # Clean up at end of test. - try: - if self.expect == EXPECT_UNKNOWN: - try: self.kill() # Just make sure its dead - except: pass - elif self.expect == EXPECT_RUNNING: - if self.poll() != None: - self.unexpected("expected running, exit code %d" % self.returncode) - else: - try: - self.kill() - except Exception,e: - self.unexpected("exception from kill: %s" % str(e)) - else: - retry(lambda: self.poll() is not None) - if self.returncode is None: # Still haven't stopped - self.kill() - self.unexpected("still running") - elif self.expect == EXPECT_EXIT_OK and self.returncode != 0: - self.unexpected("exit code %d" % self.returncode) - elif self.expect == EXPECT_EXIT_FAIL and self.returncode == 0: - self.unexpected("expected error") - finally: - self.wait() # Clean up the process. + if self.expect == EXPECT_UNKNOWN: + try: self.kill() # Just make sure its dead + except: pass + elif self.expect == EXPECT_RUNNING: + if self.poll() != None: + self.unexpected("expected running, exit code %d" % self.returncode) + else: + try: + self.kill() + except Exception,e: + self.unexpected("exception from kill: %s" % str(e)) + else: + retry(lambda: self.poll() is not None) + if self.returncode is None: # Still haven't stopped + self.kill() + self.unexpected("still running") + elif self.expect == EXPECT_EXIT_OK and self.returncode != 0: + self.unexpected("exit code %d" % self.returncode) + elif self.expect == EXPECT_EXIT_FAIL and self.returncode == 0: + self.unexpected("expected error") + self.wait() def communicate(self, input=None): @@ -325,7 +323,7 @@ class Broker(Popen): self._host = "127.0.0.1" self._agent = None - log.debug("Started broker %s (%s, %s)" % (self.name, self.pname, self.log)) + log.debug("Started broker %s" % self) def host(self): return self._host |
