ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-18845 TestHeartbeatHandler.testRegistrationRecoveryConfig is Flaky (dsen)
Date Thu, 10 Nov 2016 14:50:43 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 c5404bdd7 -> fcd204d7f


AMBARI-18845 TestHeartbeatHandler.testRegistrationRecoveryConfig is Flaky (dsen)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fcd204d7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fcd204d7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fcd204d7

Branch: refs/heads/branch-2.5
Commit: fcd204d7f79789481ef4fb743b854b6e1e68a66e
Parents: c5404bd
Author: Dmytro Sen <dsen@apache.org>
Authored: Thu Nov 10 16:49:53 2016 +0200
Committer: Dmytro Sen <dsen@apache.org>
Committed: Thu Nov 10 16:50:38 2016 +0200

----------------------------------------------------------------------
 .../ambari/server/agent/TestHeartbeatHandler.java  | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fcd204d7/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
index e50b8c9..a50a116 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
@@ -374,13 +374,7 @@ public class TestHeartbeatHandler {
   }
 
   @Test
-  public void testRegistrationRecoveryConfig() throws Exception,
-      InvalidStateTransitionException {
-    ActionManager am = actionManagerTestHelper.getMockActionManager();
-    replay(am);
-    Clusters fsm = clusters;
-    HeartBeatHandler handler = new HeartBeatHandler(fsm, new ActionQueue(), am,
-                                                    injector);
+  public void testRegistrationRecoveryConfig() throws Exception {
     Cluster cluster = heartbeatTestHelper.getDummyCluster();
     Service hdfs = cluster.addService(HDFS);
 
@@ -395,6 +389,15 @@ public class TestHeartbeatHandler {
     hdfs.addServiceComponent(HDFS_CLIENT);
     hdfs.getServiceComponent(HDFS_CLIENT).addServiceComponentHost(DummyHostname1);
 
+    // Create helper after creating service to avoid race condition caused by asynchronous
recovery configs
+    // timestamp invalidation (RecoveryConfigHelper.handleServiceComponentInstalledEvent())
+    ActionManager am = actionManagerTestHelper.getMockActionManager();
+    replay(am);
+    Clusters fsm = clusters;
+    HeartBeatHandler handler = new HeartBeatHandler(fsm, new ActionQueue(), am,
+        injector);
+    handler.start();
+
     Host hostObject = clusters.getHost(DummyHostname1);
     hostObject.setIPv4("ipv4");
     hostObject.setIPv6("ipv6");


Mime
View raw message