Skip to content

Commit dfa4f47

Browse files
committed
HBASE-22239 Also catch RemoteException in SyncReplicationTestBase.verifyReplicationRequestRejection
1 parent cd55d3f commit dfa4f47

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

hbase-server/src/test/java/org/apache/hadoop/hbase/replication/SyncReplicationTestBase.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
*/
1818
package org.apache.hadoop.hbase.replication;
1919

20+
import static org.hamcrest.CoreMatchers.instanceOf;
2021
import static org.junit.Assert.assertEquals;
2122
import static org.junit.Assert.assertFalse;
23+
import static org.junit.Assert.assertThat;
2224
import static org.junit.Assert.assertTrue;
2325
import static org.junit.Assert.fail;
2426

@@ -51,6 +53,7 @@
5153
import org.apache.hadoop.hbase.wal.WAL.Entry;
5254
import org.apache.hadoop.hbase.wal.WALEdit;
5355
import org.apache.hadoop.hbase.wal.WALKeyImpl;
56+
import org.apache.hadoop.ipc.RemoteException;
5457
import org.junit.AfterClass;
5558
import org.junit.BeforeClass;
5659

@@ -247,6 +250,12 @@ protected final void verifyRemovedPeer(String peerId, Path remoteWALDir,
247250
}
248251
}
249252

253+
private void assertRejection(Throwable error) {
254+
assertThat(error, instanceOf(DoNotRetryIOException.class));
255+
assertTrue(error.getMessage().contains("Reject to apply to sink cluster"));
256+
assertTrue(error.getMessage().contains(TABLE_NAME.toString()));
257+
}
258+
250259
protected final void verifyReplicationRequestRejection(HBaseTestingUtility utility,
251260
boolean expectedRejection) throws Exception {
252261
HRegionServer regionServer = utility.getRSForFirstRegionInTable(TABLE_NAME);
@@ -264,9 +273,10 @@ protected final void verifyReplicationRequestRejection(HBaseTestingUtility utili
264273
ReplicationProtbufUtil.replicateWALEntry(
265274
connection.getRegionServerAdmin(regionServer.getServerName()), entries, null, null, null);
266275
fail("Should throw IOException when sync-replication state is in A or DA");
276+
} catch (RemoteException e) {
277+
assertRejection(e.unwrapRemoteException());
267278
} catch (DoNotRetryIOException e) {
268-
assertTrue(e.getMessage().contains("Reject to apply to sink cluster"));
269-
assertTrue(e.getMessage().contains(TABLE_NAME.toString()));
279+
assertRejection(e);
270280
}
271281
}
272282
}

0 commit comments

Comments
 (0)