Skip to content

Commit

Permalink
HBASE-25700 Enhance znode parent validation when add_peer (#3458)
Browse files Browse the repository at this point in the history
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
  • Loading branch information
mokai87 authored and Apache9 committed Jul 11, 2021
1 parent b86d2d4 commit 3294d32
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ static class ReplicationPeerConfigBuilderImpl implements ReplicationPeerConfigBu

@Override
public ReplicationPeerConfigBuilder setClusterKey(String clusterKey) {
this.clusterKey = clusterKey;
this.clusterKey = clusterKey != null ? clusterKey.trim() : null;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,14 @@ public void testInvalidClusterKey() throws InterruptedException {
}
}

@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 {
Expand Down

0 comments on commit 3294d32

Please sign in to comment.