Mercurial > hg > thermostat
changeset 2512:da2170fe3541
Stabilize integration tests that run thermostat agent.
Reviewed-by: stooke, aazores, jerboaa
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-October/021386.html
author | Jie Kang <jkang@redhat.com> |
---|---|
date | Tue, 08 Nov 2016 08:41:50 -0500 |
parents | 00ee332a96a8 |
children | cac210e18be5 |
files | integration-tests/itest-run/src/test/java/com/redhat/thermostat/itest/DevWebStorageTest.java integration-tests/itest-run/src/test/java/com/redhat/thermostat/itest/IntegrationTest.java integration-tests/itest-run/src/test/java/com/redhat/thermostat/itest/StorageTest.java |
diffstat | 3 files changed, 9 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/integration-tests/itest-run/src/test/java/com/redhat/thermostat/itest/DevWebStorageTest.java Fri Nov 04 11:52:59 2016 -0400 +++ b/integration-tests/itest-run/src/test/java/com/redhat/thermostat/itest/DevWebStorageTest.java Tue Nov 08 08:41:50 2016 -0500 @@ -84,16 +84,11 @@ try { service.expect("Agent started."); + // Give agent some time to startup before killing it + Thread.sleep(2000l); } finally { // service.stop only stops the agent/webservice. killRecursively(spawnResult.process); - try { - // On Eclipse IDE runs this recursive killing does not kill - // mongod. Do it this way to be really sure. - stopStorage(); - } catch (Exception e) { - // ignore if second try of stopping storage failed. - } } service.expectClose();
--- a/integration-tests/itest-run/src/test/java/com/redhat/thermostat/itest/IntegrationTest.java Fri Nov 04 11:52:59 2016 -0400 +++ b/integration-tests/itest-run/src/test/java/com/redhat/thermostat/itest/IntegrationTest.java Tue Nov 08 08:41:50 2016 -0500 @@ -405,6 +405,11 @@ private static void killProcess(int processId) throws Exception { System.err.println("Killing process with pid: " + processId); Runtime.getRuntime().exec("kill " + processId).waitFor(); + + while (1 != Runtime.getRuntime().exec("kill -s 0 " + processId).waitFor()) { + // Repeatedly send kill signal until it fails meaning process doesn't exist + Thread.sleep(50l); + } } private static List<Integer> findChildPids(int processId) throws IOException {
--- a/integration-tests/itest-run/src/test/java/com/redhat/thermostat/itest/StorageTest.java Fri Nov 04 11:52:59 2016 -0400 +++ b/integration-tests/itest-run/src/test/java/com/redhat/thermostat/itest/StorageTest.java Tue Nov 08 08:41:50 2016 -0500 @@ -82,15 +82,10 @@ try { service.expect("Agent started."); + // Give agent some time to startup before killing it + Thread.sleep(2000l); } finally { killRecursively(spawnResult.process); - try { - // On Eclipse IDE runs this recursive killing does not kill - // mongod. Do it this way to be really sure. - stopStorage(); - } catch (Exception e) { - // ignore if second try of stopping storage failed. - } } service.stop();