EdColeman commented on code in PR #3199:
URL: https://github.com/apache/accumulo/pull/3199#discussion_r1114377959


##########
server/base/src/test/java/org/apache/accumulo/server/conf/CheckCompactionConfigTest.java:
##########
@@ -128,6 +128,57 @@ public void testNoPlanner() throws Exception {
     assertTrue(e.getMessage().startsWith(expectedErrorMsg));
   }
 
+  @Test
+  public void testRepeatedCompactionExecutorID() throws Exception {
+    String inputString = ("tserver.compaction.major.service.cs1.planner="
+        + "org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner \n"
+        + "tserver.compaction.major.service.cs1.planner.opts.executors=\\\n"
+        + 
"[{'name':'small','type':'internal','maxSize':'16M','numThreads':8},\\\n"
+        + 
"{'name':'medium','type':'internal','maxSize':'128M','numThreads':4},\\\n"
+        + 
"{'name':'small','type':'internal','numThreads':2}]").replaceAll("'", "\"");
+    String expectedErrorMsg = "Duplicate Compaction Executor ID found";
+
+    String filePath = writeToFileAndReturnPath(inputString);
+
+    var e = assertThrows(IllegalStateException.class,
+        () -> CheckCompactionConfig.main(new String[] {filePath}));
+    assertTrue(e.getMessage().startsWith(expectedErrorMsg));
+  }
+
+  @Test
+  public void testInvalidTypeValue() throws Exception {
+    String inputString = ("tserver.compaction.major.service.cs1.planner="
+        + "org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner \n"
+        + "tserver.compaction.major.service.cs1.planner.opts.executors=\\\n"
+        + 
"[{'name':'small','type':'internal','maxSize':'16M','numThreads':8},\\\n"
+        + 
"{'name':'medium','type':'internal','maxSize':'128M','numThreads':4},\\\n"
+        + "{'name':'large','type':'internl','numThreads':2}]").replaceAll("'", 
"\"");
+    String expectedErrorMsg = "type must be 'internal' or 'external'";
+
+    String filePath = writeToFileAndReturnPath(inputString);
+
+    var e = assertThrows(IllegalArgumentException.class,
+        () -> CheckCompactionConfig.main(new String[] {filePath}));
+    assertTrue(e.getMessage().startsWith(expectedErrorMsg));

Review Comment:
   The test is nice - but do we usually test for the text in the message?  It 
seems this would be fragile because if the message is ever changed, the this 
test might need to be updated.  No necessarily a bad thing, but I don't recall 
this being common.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to