NealSun96 commented on a change in pull request #759: Add validation logic to 
MSD write operations
URL: https://github.com/apache/helix/pull/759#discussion_r379605915
 
 

 ##########
 File path: 
helix-rest/src/test/java/org/apache/helix/rest/metadatastore/TestTrieRoutingData.java
 ##########
 @@ -249,7 +251,44 @@ public void testGetMetadataStoreRealmNoLeaf() {
       _trie.getMetadataStoreRealm("/b/c");
       Assert.fail("Expecting NoSuchElementException");
     } catch (NoSuchElementException e) {
-      Assert.assertTrue(e.getMessage().contains("No leaf node found along the 
path. Path: /b/c"));
+      Assert.assertTrue(
+          e.getMessage().contains("No sharding key found within the provided 
path. Path: /b/c"));
     }
   }
+
+  @Test(dependsOnMethods = "testConstructionNormal")
+  public void testIsShardingKeyInsertionValidNoSlash() {
+    try {
+      _trie.isShardingKeyInsertionValid("x/y/z");
+      Assert.fail("Expecting IllegalArgumentException");
+    } catch (IllegalArgumentException e) {
+      Assert.assertTrue(e.getMessage().contains(
+          "Provided shardingKey is empty or does not have a leading \"/\" 
character: x/y/z"));
+    }
+  }
+
+  @Test(dependsOnMethods = "testConstructionNormal")
+  public void testIsShardingKeyInsertionValidSlashOnly() {
+    Assert.assertFalse(_trie.isShardingKeyInsertionValid("/"));
+  }
+
+  @Test(dependsOnMethods = "testConstructionNormal")
+  public void testIsShardingKeyInsertionValidNormal() {
 
 Review comment:
   Good catch, I'll add validation for sharding key formats. 

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to