Repository: activemq-artemis
Updated Branches:
  refs/heads/master 8859d9922 -> 293d0266c


NO-JIRA fixing race on a test


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/293d0266
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/293d0266
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/293d0266

Branch: refs/heads/master
Commit: 293d0266c4560101ec20fd06470931e7ccb2a802
Parents: 8859d99
Author: Clebert Suconic <[email protected]>
Authored: Sun May 6 19:11:31 2018 -0400
Committer: Clebert Suconic <[email protected]>
Committed: Sun May 6 19:11:31 2018 -0400

----------------------------------------------------------------------
 .../integration/clientcrash/ClientCrashTest.java  | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/293d0266/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java
----------------------------------------------------------------------
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java
index 956b8bd..625aeb9 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java
@@ -28,6 +28,7 @@ import 
org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage;
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.util.SpawnedVMSupport;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -62,6 +63,19 @@ public class ClientCrashTest extends ClientTestBase {
 
    private ServerLocator locator;
 
+   Process p;
+
+   @After
+   public void tearDown() throws Exception {
+      super.tearDown();
+      if (p != null) {
+         long timeout = System.currentTimeMillis() + 5000;
+         while (timeout > System.currentTimeMillis() && p.isAlive()) {
+            p.destroy();
+         }
+      }
+   }
+
    // Constructors --------------------------------------------------
 
    // Public --------------------------------------------------------
@@ -76,7 +90,7 @@ public class ClientCrashTest extends ClientTestBase {
       // spawn a JVM that creates a Core client, which sends a message
       // It has to be spawned after the queue was created.
       // if the client is too fast you race the send before the queue was 
created, missing a message
-      Process p = SpawnedVMSupport.spawnVM(CrashClient.class.getName());
+      p = SpawnedVMSupport.spawnVM(CrashClient.class.getName());
 
       ClientConsumer consumer = session.createConsumer(ClientCrashTest.QUEUE);
       ClientProducer producer = session.createProducer(ClientCrashTest.QUEUE);
@@ -127,7 +141,7 @@ public class ClientCrashTest extends ClientTestBase {
       session.createQueue(ClientCrashTest.QUEUE2, ClientCrashTest.QUEUE2, 
null, false);
 
       // spawn a JVM that creates a Core client, which sends a message
-      Process p = SpawnedVMSupport.spawnVM(CrashClient2.class.getName());
+      p = SpawnedVMSupport.spawnVM(CrashClient2.class.getName());
 
       ClientCrashTest.log.debug("waiting for the client VM to crash ...");
       p.waitFor();

Reply via email to