You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by GitBox <gi...@apache.org> on 2019/01/29 15:24:02 UTC

[GitHub] TomasHofman commented on a change in pull request #2287: ARTEMIS-2069 Backup doesn't activate after shared store is reconnected

TomasHofman commented on a change in pull request #2287: ARTEMIS-2069 Backup doesn't activate after shared store is reconnected
URL: https://github.com/apache/activemq-artemis/pull/2287#discussion_r251879550
 
 

 ##########
 File path: tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/FileLockNodeManagerTest.java
 ##########
 @@ -0,0 +1,75 @@
+package org.apache.activemq.artemis.tests.extras.byteman;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.activemq.artemis.core.server.impl.FileLockNodeManager;
+import org.jboss.byteman.contrib.bmunit.BMRule;
+import org.jboss.byteman.contrib.bmunit.BMRules;
+import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(BMUnitRunner.class)
+public class FileLockNodeManagerTest {
+
+    private static final int TIMEOUT_TOLERANCE = 50;
+
+    private File sharedDir;
+
+    public FileLockNodeManagerTest() throws IOException {
+        sharedDir = File.createTempFile("shared-dir", "");
+        sharedDir.delete();
+        Assert.assertTrue(sharedDir.mkdir());
+
+    }
+
+    @Test
+    @BMRules(
+            rules = {@BMRule(
+                    name = "throw IOException during activation",
+                    targetClass = "org.apache.activemq.artemis.core.server.impl.FileLockNodeManager",
+                    targetMethod = "tryLock",
+                    targetLocation = "AT ENTRY",
+                    action = "THROW new IOException(\"IO Error\");")
+            })
+    public void test() throws Exception {
+        measureLockAcquisisionTimeout(100); // warm-up
+
+        assertMeasuredTimeoutFor(100);
+        assertMeasuredTimeoutFor(120);
+        assertMeasuredTimeoutFor(200);
+//        assertMeasuredTimeoutFor(1000);
 
 Review comment:
   Done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services