bin/plugin
tests for missing plugin name when passing --url
#6013
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When setting the
--url
, it now sets the implied action--INSTALL
. Therefore, if the user fails to supply the install flag themselves, then the plugin name will be caught as missing (also added to remove incase a future scenario allows that) and fail immediately.Adding code to test for unset plugin names to fail fast with descriptive error messages (for all flags that require a value). Also simplified the series of
if
statements checking for the commands by using aswitch
(now that it's using Java 7), added tests, and updated random exceptions with the up-to-date flag names (e.g., "--verbose" instead of "-verbose").@dadoonet Note: This will cause or have merge conflicts with #5977. I have no problem with my changes just being incorporated into that PR or doing the merge here.
Also, while messing with the unit tests, I noticed that the package for the tests is
org.elasticsearch.plugin
while the non-test code isorg.elasticsearch.plugins
. That's probably worth a cleanup by whoever loses the merge; I avoided doing it upfront to simplify any potential merge.Closes #5976