-
Notifications
You must be signed in to change notification settings - Fork 14.7k
MINOR: Add plugin.path config non-empty check in connect-plugin-path.sh #20638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -333,6 +333,63 @@ public void testSyncManifestsKeepNotFound(PluginLocationType type) { | |
assertBadPackagingPluginsStatus(table, false); | ||
} | ||
|
||
@Test | ||
public void testListEmptyPluginPathArg() { | ||
CommandResult res = runCommand( | ||
"list", | ||
"--plugin-path", | ||
"" | ||
); | ||
assertNotEquals(0, res.returnCode); | ||
assertTrue("'--plugin-path' must not be empty.\n".equals(res.err)); | ||
|
||
} | ||
|
||
@Test | ||
public void testListEmptyPluginPathElementArg() { | ||
CommandResult res = runCommand( | ||
"list", | ||
"--plugin-path", | ||
"location-a,,location-b" | ||
); | ||
assertNotEquals(0, res.returnCode); | ||
assertTrue("'--plugin-path' values must not be empty.\n".equals(res.err)); | ||
|
||
} | ||
|
||
@Test | ||
public void testListEmptyPluginPathInWorkerConfig() { | ||
Path configPath = workspace.resolve("worker-empty.properties"); | ||
try { | ||
Files.writeString(configPath, "plugin.path=", StandardCharsets.UTF_8); | ||
} catch (IOException e) { | ||
fail("Failed to create test worker config: " + e.getMessage()); | ||
} | ||
|
||
CommandResult res = runCommand( | ||
"list", | ||
"--worker-config", | ||
configPath.toString() | ||
); | ||
assertNotEquals(0, res.returnCode); | ||
assertTrue("'plugin.path' must not be empty.\n".equals(res.err)); | ||
|
||
} | ||
|
||
@Test | ||
public void testListEmptyPluginPathElementInWorkerConfig() { | ||
Path configPath = workspace.resolve("worker-empty-element.properties"); | ||
try { | ||
Files.writeString(configPath, "plugin.path=location-a,,location-b", StandardCharsets.UTF_8); | ||
} catch (IOException e) { | ||
fail("Failed to create test worker config: " + e.getMessage()); | ||
} | ||
|
||
CommandResult res = runCommand( | ||
"list", | ||
"--worker-config", | ||
configPath.toString() | ||
); | ||
assertNotEquals(0, res.returnCode); | ||
assertTrue("'plugin.path' values must not be empty.\n".equals(res.err)); | ||
|
||
} | ||
|
||
private static Map<String, List<String[]>> assertListSuccess(CommandResult result) { | ||
assertEquals(0, result.returnCode); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should throw a
ConfigException
when validatingWorkerConfig.PLUGIN_PATH_CONFIG
at this stage. This would preserve the same behavior as whenWorkerConfig.PLUGIN_PATH_CONFIG
is set to an empty value in the config.