Repository: asterixdb Updated Branches: refs/heads/master 78b1a694b -> 27a75d708
[ASTERIXDB-2060][TEST] Stop activity in tests with active recovery - user model changes: no - storage format changes: no - interface changes: no details: - Hangs were caused by some test cases leaving a recovery task running on the listener. Because each test case has its own listener but the test cases share the MetadataLockManager a hang occurs. Change-Id: I8dd31a7b9a82678e682d04d17760aa4b10eb80ce Reviewed-on: https://asterix-gerrit.ics.uci.edu/1962 Sonar-Qube: Jenkins <[email protected]> Reviewed-by: Michael Blow <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/27a75d70 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/27a75d70 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/27a75d70 Branch: refs/heads/master Commit: 27a75d70883cc753bab39beea745e30e5143dfbb Parents: 78b1a69 Author: Abdullah Alamoudi <[email protected]> Authored: Wed Aug 23 09:03:28 2017 -0700 Committer: abdullah alamoudi <[email protected]> Committed: Wed Aug 23 11:25:02 2017 -0700 ---------------------------------------------------------------------- .../asterix/test/active/ActiveEventsListenerTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/27a75d70/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/ActiveEventsListenerTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/ActiveEventsListenerTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/ActiveEventsListenerTest.java index c5465b1..97283b6 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/ActiveEventsListenerTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/ActiveEventsListenerTest.java @@ -47,6 +47,7 @@ import org.apache.asterix.metadata.entities.Feed; import org.apache.asterix.metadata.lock.MetadataLockManager; import org.apache.asterix.runtime.utils.CcApplicationContext; import org.apache.asterix.test.active.TestEventsListener.Behavior; +import org.apache.asterix.test.base.TestMethodTracer; import org.apache.asterix.translator.IStatementExecutor; import org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint; import org.apache.hyracks.api.client.IHyracksClientConnection; @@ -58,7 +59,9 @@ import org.apache.hyracks.control.cc.application.CCServiceContext; import org.junit.After; import org.junit.Assert; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestRule; import org.mockito.Mockito; public class ActiveEventsListenerTest { @@ -86,6 +89,9 @@ public class ActiveEventsListenerTest { static AlgebricksAbsolutePartitionConstraint locations; static ExecutorService executor; + @Rule + public TestRule watcher = new TestMethodTracer(); + @Before public void setUp() throws Exception { jobIdFactory = new JobIdFactory(); @@ -373,6 +379,10 @@ public class ActiveEventsListenerTest { ActivityState state = listener.getState(); Assert.assertTrue(state == ActivityState.RECOVERING || state == ActivityState.TEMPORARILY_FAILED); Assert.assertNotNull(listener.getRecoveryTask()); + Action stopActivity = users[1].stopActivity(listener); + stopActivity.sync(); + assertSuccess(stopActivity); + Assert.assertEquals(ActivityState.STOPPED, listener.getState()); } @Test @@ -394,6 +404,10 @@ public class ActiveEventsListenerTest { ActivityState state = listener.getState(); Assert.assertTrue(state == ActivityState.RECOVERING || state == ActivityState.TEMPORARILY_FAILED); Assert.assertNotNull(listener.getRecoveryTask()); + Action stopActivity = users[1].stopActivity(listener); + stopActivity.sync(); + assertSuccess(stopActivity); + Assert.assertEquals(ActivityState.STOPPED, listener.getState()); } @Test
