ndimiduk commented on a change in pull request #1141: HBASE-23808 [Flakey Test] 
TestMasterShutdown#testMasterShutdownBefore…
URL: https://github.com/apache/hbase/pull/1141#discussion_r377394544
 
 

 ##########
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
 ##########
 @@ -128,41 +142,50 @@ public void 
testMasterShutdownBeforeStartingAnyRegionServer() throws Exception {
     conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, 1);
 
     // Start the cluster
-    final HBaseTestingUtility util = new HBaseTestingUtility(conf);
-    util.startMiniDFSCluster(3);
-    util.startMiniZKCluster();
-    util.createRootDir();
-    final LocalHBaseCluster cluster =
-        new LocalHBaseCluster(conf, NUM_MASTERS, NUM_RS, HMaster.class,
-            MiniHBaseCluster.MiniHBaseClusterRegionServer.class);
-    final int MASTER_INDEX = 0;
-    final MasterThread master = cluster.getMasters().get(MASTER_INDEX);
-    master.start();
-    LOG.info("Called master start on " + master.getName());
-    Thread shutdownThread = new Thread("Shutdown-Thread") {
-      @Override
-      public void run() {
-        LOG.info("Before call to shutdown master");
-        try (Connection connection = createConnection(util); Admin admin = 
connection.getAdmin()) {
-          admin.shutdown();
-        } catch (Exception e) {
-          LOG.info("Error while calling Admin.shutdown, which is expected: " + 
e.getMessage());
+    LocalHBaseCluster cluster = null;
+    try {
+      htu = new HBaseTestingUtility(conf);
+      htu.startMiniDFSCluster(3);
+      htu.startMiniZKCluster();
+      htu.createRootDir();
+      cluster = new LocalHBaseCluster(conf, NUM_MASTERS, NUM_RS, HMaster.class,
+        MiniHBaseCluster.MiniHBaseClusterRegionServer.class);
+      final int MASTER_INDEX = 0;
+      final MasterThread master = cluster.getMasters().get(MASTER_INDEX);
+      master.start();
+      LOG.info("Called master start on " + master.getName());
+      final LocalHBaseCluster finalCluster = cluster;
+      Thread shutdownThread = new Thread("Shutdown-Thread") {
+        @Override
+        public void run() {
+          LOG.info("Before call to shutdown master");
+          try (Connection connection = createConnection(htu); Admin admin = 
connection.getAdmin()) {
+            admin.shutdown();
 
 Review comment:
   I re-read your changes on the branch. Let me try to merge those with the 
general cleanup I'm attempting here. Hopefully when it's done, you can just 
drop the change to this test from the feature branch.

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


With regards,
Apache Git Services

Reply via email to