-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Make action names available in NodeClient #83919
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
Conversation
The actions available in NodeClient are registered on node startup and hidden to callers. However, operator privileges needs to verify that all actions are classified into operator and non-operator actions. Currently the test uses reflection hacks to make the internal action objects available. This commit makes the action names available as a public method on NodeClient, so that the reflection hacks are no longer necessary. It would be nice to have a test specific way to expose this, but the test code in question actually serves the action names up in a rest api, so it is not test code, as far as server is concerned, that needs the action names.
Pinging @elastic/es-core-infra (Team:Core/Infra) |
Pinging @elastic/es-security (Team:Security) |
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.
LGTM
Thanks Ryan!
@@ -41,19 +33,7 @@ public String getName() { | |||
@SuppressWarnings({ "rawtypes", "unchecked" }) |
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.
Both @SuppressForbidden
and @SuppressWarnings
do not seem needed with the proposed changes.
*/ | ||
public List<String> getActionNames() { | ||
return actions.keySet().stream().map(ActionType::name).collect(Collectors.toList()); | ||
} |
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.
Trivially, .collect(Collectors.toList())
could be replaced with .toList()
, which has the advantage of creating an unmodifiable list. (additionally, if this suggestions is adopted, then the javadoc could reflect the unmodifiability of the returned list)
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 changed to .toList()
, but I did not modify the javadoc because I think it should be assumed that any returned collection is not "live" (ie cannot be modified).
@elasticmachine run elasticsearch-ci/bwc |
…ijun/elasticsearch into fix-none-tsdb-index-dimension-tests * 'fix-none-tsdb-index-dimension-tests' of github.com:weizijun/elasticsearch: (37 commits) [docs] Mention JDK 17 in the Contributing docs (elastic#84018) Fix GeoIpDownloader startup during rolling upgrade (elastic#84000) Script: Fields API for Dense Vector (elastic#83550) Move InferenceConfigUpdate under VersionedNamedWriteable (elastic#84022) [ML] Fix license feature test cleanup (elastic#84020) Replace deprecated api in artifact transforms (elastic#84015) QL: Add leniency option to SQL CLI (elastic#83795) [Stack Monitoring] add kibana_stats version alias to -mb template (elastic#83930) Optimize spliterator for ImmutableOpenMap (elastic#83899) Feature usage actions for archive (elastic#83931) Use latch to speedup multi feature migration test (elastic#84007) Make action names available in NodeClient (elastic#83919) [DOCS] Re-add HTTP proxy setings from elastic#82737 (elastic#84001) Add CI matrix configuration for snapshot BWC versions (elastic#83990) Update YAML Rest tests to check for product header on all responses (elastic#83290) TSDB: Add time series aggs cancellation (elastic#83492) [DOCS] Fix percolate query headings (elastic#83988) [DOCS] Move tip for percolate query example (elastic#83972) Simplify LocalExporter cleaner function to fix failing tests (elastic#83812) [GCE Discovery] Correcly handle large zones with 500 or more instances (elastic#83785) ...
The actions available in NodeClient are registered on node startup and
hidden to callers. However, operator privileges needs to verify that all
actions are classified into operator and non-operator actions. Currently
the test uses reflection hacks to make the internal action objects
available.
This commit makes the action names available as a public method on
NodeClient, so that the reflection hacks are no longer necessary. It
would be nice to have a test specific way to expose this, but the test
code in question actually serves the action names up in a rest api, so
it is not test code, as far as server is concerned, that needs the
action names.