epugh commented on code in PR #5289:
URL: https://github.com/apache/solr/pull/5289#discussion_r4468926599
##########
solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java:
##########
@@ -673,4 +673,81 @@ public void testFailExecuteScript() throws Exception {
int code = runTool(tool, toolArgs);
assertEquals("Execution should have failed with return code 1", 1, code);
}
+
+ @Test
+ public void testMissingDefaultExampleDirectoryExplainsSlimDistribution()
throws Exception {
+ Path solrServerDir = createTestServerDir();
+ RunExampleTool tool =
+ new RunExampleTool(null, System.in, new
CLITestHelper.TestingRuntime(false));
+
+ IllegalArgumentException exception =
+ expectThrows(
+ IllegalArgumentException.class,
+ () -> tool.initDirs(solrServerDir.toString(), null, null, null,
"techproducts"));
+
+ assertEquals(
+ "Examples are not included in the slim distribution. "
+ + "Use the full Solr distribution to run examples.",
+ exception.getMessage());
+ }
+
+ @Test
+ public void testExplicitMissingExampleDirectoryRemainsInvalid() throws
Exception {
+ Path solrServerDir = createTestServerDir();
+ Path missingExampleDir =
solrServerDir.getParent().resolve("custom-example");
+ RunExampleTool tool =
+ new RunExampleTool(null, System.in, new
CLITestHelper.TestingRuntime(false));
+
+ IllegalArgumentException exception =
+ expectThrows(
+ IllegalArgumentException.class,
+ () ->
+ tool.initDirs(
+ solrServerDir.toString(),
+ null,
+ missingExampleDir.toString(),
+ null,
+ "techproducts"));
+
+ assertTrue(
+ exception.getMessage(),
+ exception.getMessage().startsWith("Value of --example-dir option is
invalid! "));
Review Comment:
I wonder if "is invalid" or "doesn't exist" would be a better error message?
Do we have a pattern at all of how we convey a directory doesn't exist in our
CLI?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]