From 98600f1860d7bb181456f95b660f95abec91a574 Mon Sep 17 00:00:00 2001 From: Duo Zhang Date: Wed, 29 Aug 2018 18:06:02 +0800 Subject: [PATCH] HBASE-21128 TestAsyncRegionAdminApi.testAssignRegionAndUnassignRegion is broken --- .../hadoop/hbase/client/TestAsyncRegionAdminApi.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java index a8ad4244620..338db00c8f9 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java @@ -17,9 +17,11 @@ */ package org.apache.hadoop.hbase.client; +import static org.hamcrest.CoreMatchers.instanceOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -83,7 +85,13 @@ public class TestAsyncRegionAdminApi extends TestAsyncAdminBase { // Region is assigned now. Let's assign it again. // Master should not abort, and region should stay assigned. - admin.assign(hri.getRegionName()).get(); + try { + admin.assign(hri.getRegionName()).get(); + fail("Should fail when assigning an already onlined region"); + } catch (ExecutionException e) { + // Expected + assertThat(e.getCause(), instanceOf(DoNotRetryRegionException.class)); + } try { am.waitForAssignment(hri); fail("Expected NoSuchProcedureException");