You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2020/03/12 04:01:42 UTC

[hbase] branch branch-2 updated: HBASE-23956 Use less resources running tests (#1266) Addendum: Two more tests that had issues because parent cut down the number of default RegionServers launched.

This is an automated email from the ASF dual-hosted git repository.

stack pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 4214a4f  HBASE-23956 Use less resources running tests (#1266) Addendum: Two more tests that had issues because parent cut down the number of default RegionServers launched.
4214a4f is described below

commit 4214a4f0b9f77db4cf1507e5ab499b59f7e96710
Author: stack <st...@apache.org>
AuthorDate: Wed Mar 11 21:00:35 2020 -0700

    HBASE-23956 Use less resources running tests (#1266)
    Addendum: Two more tests that had issues because parent cut
    down the number of default RegionServers launched.
---
 .../TestReplicationChangingPeerRegionservers.java      | 18 ++++++++++--------
 .../hbase/replication/TestReplicationStatus.java       |  8 ++++++++
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java
index a7d983c..2fcc2c8 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -20,12 +20,11 @@ package org.apache.hadoop.hbase.replication;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
-
 import java.io.IOException;
 import java.util.List;
-
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.Waiter;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
@@ -45,7 +44,6 @@ import org.junit.runners.Parameterized.Parameter;
 import org.junit.runners.Parameterized.Parameters;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList;
 
 /**
@@ -62,7 +60,7 @@ public class TestReplicationChangingPeerRegionservers extends TestReplicationBas
   private static final Logger LOG =
       LoggerFactory.getLogger(TestReplicationChangingPeerRegionservers.class);
 
-  @Parameter
+  @SuppressWarnings("checkstyle:VisibilityModifier") @Parameter
   public boolean serialPeer;
 
   @Override
@@ -75,9 +73,6 @@ public class TestReplicationChangingPeerRegionservers extends TestReplicationBas
     return ImmutableList.of(true, false);
   }
 
-  /**
-   * @throws java.lang.Exception
-   */
   @Before
   public void setUp() throws Exception {
     // Starting and stopping replication can make us miss new logs,
@@ -118,6 +113,13 @@ public class TestReplicationChangingPeerRegionservers extends TestReplicationBas
   public void testChangingNumberOfPeerRegionServers() throws IOException, InterruptedException {
     LOG.info("testSimplePutDelete");
     MiniHBaseCluster peerCluster = UTIL2.getMiniHBaseCluster();
+    // This test wants two RS's up. We only run one generally so add one.
+    peerCluster.startRegionServer();
+    Waiter.waitFor(peerCluster.getConfiguration(), 30000, new Waiter.Predicate<Exception>() {
+      @Override public boolean evaluate() throws Exception {
+        return peerCluster.getLiveRegionServerThreads().size() > 1;
+      }
+    });
     int numRS = peerCluster.getRegionServerThreads().size();
 
     doPutTest(Bytes.toBytes(1));
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStatus.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStatus.java
index 50aaa34..ca6680e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStatus.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStatus.java
@@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.ClusterMetrics.Option;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.ServerMetrics;
 import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.Waiter;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
@@ -59,6 +60,13 @@ public class TestReplicationStatus extends TestReplicationBase {
    */
   @Test
   public void testReplicationStatus() throws Exception {
+    // This test wants two RS's up. We only run one generally so add one.
+    UTIL1.getMiniHBaseCluster().startRegionServer();
+    Waiter.waitFor(UTIL1.getConfiguration(), 30000, new Waiter.Predicate<Exception>() {
+      @Override public boolean evaluate() throws Exception {
+        return UTIL1.getMiniHBaseCluster().getLiveRegionServerThreads().size() > 1;
+      }
+    });
     Admin hbaseAdmin = UTIL1.getAdmin();
     // disable peer <= WHY? I DON'T GET THIS DISABLE BUT TEST FAILS W/O IT.
     hbaseAdmin.disableReplicationPeer(PEER_ID2);