infraio commented on a change in pull request #2347:
URL: https://github.com/apache/hbase/pull/2347#discussion_r483315658
##########
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");
+ } catch (Exception e) {
+ Assert.assertTrue(
+ e instanceof RetriesExhaustedException && e.getCause() instanceof
RetriesExhaustedException
+ && e.getCause().getCause() instanceof CallTimeoutException);
Review comment:
Need to getCause twice, 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:
[email protected]