You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/09/04 00:04:57 UTC

[GitHub] [hbase] infraio commented on a change in pull request #2347: HBASE-24979 : Client operation timeout test for batch requests

infraio commented on a change in pull request #2347:
URL: https://github.com/apache/hbase/pull/2347#discussion_r483315277



##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientOperationTimeout.java
##########
@@ -117,37 +124,78 @@ public static void tearDown() throws Exception {
   }
 
   /**
-   * 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 {
+  @Test
+  public void testGetTimeout() {
     DELAY_GET = 600;
-    TABLE.get(new Get(ROW));
+    try {
+      TABLE.get(new Get(ROW));
+      throw new AssertionError("should not reach here");
+    } catch (Exception e) {
+      Assert.assertTrue(
+        e instanceof RetriesExhaustedException && e.getCause() instanceof CallTimeoutException);
+    }
   }
 
   /**
-   * 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)
-  public void testPutTimeout() throws Exception {
+  @Test
+  public void testPutTimeout() {
     DELAY_MUTATE = 600;
-
     Put put = new Put(ROW);
     put.addColumn(FAMILY, QUALIFIER, VALUE);
-    TABLE.put(put);
+    try {
+      TABLE.put(put);
+      throw new AssertionError("should not reach here");
+    } catch (Exception e) {
+      Assert.assertTrue(
+        e instanceof RetriesExhaustedException && e.getCause() instanceof CallTimeoutException);
+    }
+  }
+
+  /**
+   * Tests that a batch mutate on a table throws {@link RetriesExhaustedException} when the
+   * operation takes longer than 'hbase.client.operation.timeout'.
+   */
+  @Test
+  public void testMultiPutsTimeout() {
+    DELAY_BATCH_MUTATE = 600;
+    Put put1 = new Put(ROW);
+    put1.addColumn(FAMILY, QUALIFIER, VALUE);
+    Put put2 = new Put(ROW);
+    put2.addColumn(FAMILY, QUALIFIER, VALUE);
+    List<Put> puts = new ArrayList<>();
+    puts.add(put1);
+    puts.add(put2);
+    try {
+      TABLE.batch(puts, new Object[2]);
+      throw new AssertionError("should not reach here");

Review comment:
       use fail("should not reach here"); ?




----------------------------------------------------------------
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:
users@infra.apache.org