ankitjain64 commented on a change in pull request #2284:
URL: https://github.com/apache/hbase/pull/2284#discussion_r476944550



##########
File path: 
hbase-replication/src/test/java/org/apache/hadoop/hbase/replication/TestZKReplicationPeerStorage.java
##########
@@ -215,4 +218,52 @@ public void testNoSyncReplicationState()
     assertNotEquals(-1, ZKUtil.checkExists(UTIL.getZooKeeperWatcher(),
       STORAGE.getNewSyncReplicationStateNode(peerId)));
   }
+
+  @Test
+  public void testDefaultReplicationPeerConfigIsAppliedIfNotAlreadySet(){
+    String customPeerConfigKey = "hbase.xxx.custom_config";
+    String customPeerConfigValue = "test";
+
+    String customPeerConfigSecondKey = "hbase.xxx.custom_second_config";
+    String customPeerConfigSecondValue = "testSecond";
+
+    ReplicationPeerConfig existingReplicationPeerConfig = getConfig(1);
+
+    // custom config not present
+    
assertEquals(existingReplicationPeerConfig.getConfiguration().get(customPeerConfigKey),
 null);
+
+    Configuration conf = UTIL.getConfiguration();
+    conf.set(ReplicationPeerConfigUtil.HBASE_REPLICATION_PEER_BASE_CONFIG,
+      
customPeerConfigKey.concat("=").concat(customPeerConfigValue).concat(";").
+        
concat(customPeerConfigSecondKey).concat("=").concat(customPeerConfigSecondValue));
+
+    ReplicationPeerConfig updatedReplicationPeerConfig = 
ReplicationPeerConfigUtil.
+      addBasePeerConfigsIfNotPresent(conf,existingReplicationPeerConfig);
+
+    assertEquals(customPeerConfigValue, 
updatedReplicationPeerConfig.getConfiguration().
+      get(customPeerConfigKey));
+    assertEquals(customPeerConfigSecondValue, 
updatedReplicationPeerConfig.getConfiguration().
+      get(customPeerConfigSecondKey));
+  }
+
+  @Test
+  public void testDefaultReplicationPeerConfigOverrideIfAlreadySet(){

Review comment:
       Added the tests for admin code paths.
   
   The behavior after this patch is that a peer config will only be updated by 
`configuration` object if that new configuration was not present in 
`ReplicationPeerConfig`. If it was already present then old value is retained 
and values from `configuration` object won't make any changes.




----------------------------------------------------------------
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]


Reply via email to