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:03:22 UTC

[hbase] branch master 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 master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new 20658c5  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.
20658c5 is described below

commit 20658c5139552a3409163bc364362e51ea41a1dc
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         | 15 ++++++++++-----
 .../hadoop/hbase/replication/TestReplicationStatus.java   |  8 ++++++++
 2 files changed, 18 insertions(+), 5 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 3eb58a4..02ae90b 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(0)
+  @SuppressWarnings("checkstyle:VisibilityModifier") @Parameter(0)
   public boolean serialPeer;
 
   @Parameter(1)
@@ -124,6 +122,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);