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

zhangduo pushed a commit to branch HBASE-21512
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/HBASE-21512 by this push:
     new 787fdfb  HBASE-22295 Addendum create table before all tests
787fdfb is described below

commit 787fdfb79cc6610297532abe1d4f76298a1b31fd
Author: Duo Zhang <[email protected]>
AuthorDate: Mon Apr 29 18:30:39 2019 +0800

    HBASE-22295 Addendum create table before all tests
---
 .../hadoop/hbase/TestClientOperationTimeout.java   | 35 ++++++++++------------
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientOperationTimeout.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientOperationTimeout.java
index 4dd614b..ea6c903 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientOperationTimeout.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientOperationTimeout.java
@@ -72,14 +72,13 @@ public class TestClientOperationTimeout {
   private static int DELAY_SCAN;
   private static int DELAY_MUTATE;
 
-  private final byte[] FAMILY = Bytes.toBytes("family");
-  private final byte[] ROW = Bytes.toBytes("row");
-  private final byte[] QUALIFIER = Bytes.toBytes("qualifier");
-  private final byte[] VALUE = Bytes.toBytes("value");
+  private static final byte[] FAMILY = Bytes.toBytes("family");
+  private static final byte[] ROW = Bytes.toBytes("row");
+  private static final byte[] QUALIFIER = Bytes.toBytes("qualifier");
+  private static final byte[] VALUE = Bytes.toBytes("value");
 
-  @Rule
-  public TestName name = new TestName();
-  private Table table;
+  private static final TableName TABLE_NAME = TableName.valueOf("Timeout");
+  private static Table TABLE;
 
   @BeforeClass
   public static void setUpClass() throws Exception {
@@ -87,11 +86,12 @@ public class TestClientOperationTimeout {
     
TESTING_UTIL.getConfiguration().setLong(HConstants.HBASE_CLIENT_META_OPERATION_TIMEOUT,
 500);
     
TESTING_UTIL.getConfiguration().setLong(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD,
 500);
     
TESTING_UTIL.getConfiguration().setLong(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 
1);
-
     // Set RegionServer class and use default values for other options.
-    StartMiniClusterOption option = StartMiniClusterOption.builder()
-        .rsClass(DelayedRegionServer.class).build();
+    StartMiniClusterOption option =
+      
StartMiniClusterOption.builder().rsClass(DelayedRegionServer.class).build();
     TESTING_UTIL.startMiniCluster(option);
+
+    TABLE = TESTING_UTIL.createTable(TABLE_NAME, FAMILY);
   }
 
   @Before
@@ -99,11 +99,6 @@ public class TestClientOperationTimeout {
     DELAY_GET = 0;
     DELAY_SCAN = 0;
     DELAY_MUTATE = 0;
-
-    table = TESTING_UTIL.createTable(TableName.valueOf(name.getMethodName()), 
FAMILY);
-    Put put = new Put(ROW);
-    put.addColumn(FAMILY, QUALIFIER, VALUE);
-    table.put(put);
   }
 
   @AfterClass
@@ -112,17 +107,17 @@ public class TestClientOperationTimeout {
   }
 
   /**
-   * Tests that a get on a table throws {@link SocketTimeoutException} when 
the operation takes
+   * Tests that a get on a table throws {@link RetriesExhaustedException} when 
the operation takes
    * longer than 'hbase.client.operation.timeout'.
    */
   @Test(expected = RetriesExhaustedException.class)
   public void testGetTimeout() throws Exception {
     DELAY_GET = 600;
-    table.get(new Get(ROW));
+    TABLE.get(new Get(ROW));
   }
 
   /**
-   * Tests that a put on a table throws {@link SocketTimeoutException} when 
the operation takes
+   * Tests that a put on a table throws {@link RetriesExhaustedException} when 
the operation takes
    * longer than 'hbase.client.operation.timeout'.
    */
   @Test(expected = RetriesExhaustedException.class)
@@ -131,7 +126,7 @@ public class TestClientOperationTimeout {
 
     Put put = new Put(ROW);
     put.addColumn(FAMILY, QUALIFIER, VALUE);
-    table.put(put);
+    TABLE.put(put);
   }
 
   /**
@@ -141,7 +136,7 @@ public class TestClientOperationTimeout {
   @Test(expected = RetriesExhaustedException.class)
   public void testScanTimeout() throws Exception {
     DELAY_SCAN = 600;
-    ResultScanner scanner = table.getScanner(new Scan());
+    ResultScanner scanner = TABLE.getScanner(new Scan());
     scanner.next();
   }
 

Reply via email to