HBASE-25700 Enhance znode parent validation when add_peer (#3458)
Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
This commit is contained in:
parent
b86d2d4020
commit
3294d32f46
|
@ -263,7 +263,7 @@ public class ReplicationPeerConfig {
|
|||
|
||||
@Override
|
||||
public ReplicationPeerConfigBuilder setClusterKey(String clusterKey) {
|
||||
this.clusterKey = clusterKey;
|
||||
this.clusterKey = clusterKey != null ? clusterKey.trim() : null;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -477,6 +477,14 @@ public class TestAsyncReplicationAdminApi extends TestAsyncAdminBase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClusterKeyWithTrailingSpace() throws Exception {
|
||||
admin.addReplicationPeer(ID_ONE,
|
||||
ReplicationPeerConfig.newBuilder().setClusterKey(KEY_ONE + " ").build()).get();
|
||||
String clusterKey = admin.getReplicationPeerConfig(ID_ONE).get().getClusterKey();
|
||||
assertEquals(KEY_ONE, clusterKey);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidReplicationEndpoint() throws InterruptedException {
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue