-
Notifications
You must be signed in to change notification settings - Fork 25.3k
[Entitlements] Add test entitlement bootstrap and initialization classes #128625
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
…ntitlements-bootstrap-2
…ntitlements-bootstrap-2
…ntitlements-bootstrap-2
…ntitlements-bootstrap-2
Pinging @elastic/es-core-infra (Team:Core/Infra) |
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! One minor comment.
* Activates entitlement checking in tests. | ||
* @param bootstrapArgs arguments used for and passed to entitlement initialization | ||
*/ | ||
public static void bootstrap(BootstrapArgs bootstrapArgs) { |
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 thought we were going to rename BootstrapArgs
to InitializationArgs
or something like that?
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.
Actually, since this moves a class completely instead of just a simple rename, let's do this in a follow up pr.
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.
Yep, that's coming right up! I'm planning to encapsulate BootstrapArgs
and PathResolver
in the next PR.
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
* @return the plugin info | ||
* @throws IOException if an I/O exception occurred reading the plugin descriptor | ||
*/ | ||
public static PluginDescriptor readInternalDescriptor(InputStream stream) throws IOException { |
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.
nit: readFromStream to match readFromProperties above?
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 this does less than readFromProperties
: it does not support stable plugins.
I can go with readInternalDescriptorFromStream
if that's better.
...rc/main/java/org/elasticsearch/entitlement/initialization/TestEntitlementInitialization.java
Outdated
Show resolved
Hide resolved
💔 Backport failed
You can use sqren/backport to manually backport by running |
…ses (elastic#128625) * Initialization class as argument to EntitlementAgent * visibility changes * WIP: test entitlement bootstrap and initialization classes * Simplify * Moving packages to reduce visibility * adjust visibility * add plugins descriptor + policy parsing * PR comments * update visibility, uncomment TestBuildInfoParser usage * [CI] Auto commit changes from spotless * Factor out createPolicyManager to help merge * TestEntitlementInitialization is not yet implemented * Respond to PR comments --------- Co-authored-by: Lorenzo Dematte <lorenzo.dematte@elastic.co> Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Backporting to 8.19 in #128691 |
…8691) * Inline call to getVersionSpecificCheckerClass. This makes the code a smidge more like main to ease the backport * [Entitlements] Add test entitlement bootstrap and initialization classes (#128625) * Initialization class as argument to EntitlementAgent * visibility changes * WIP: test entitlement bootstrap and initialization classes * Simplify * Moving packages to reduce visibility * adjust visibility * add plugins descriptor + policy parsing * PR comments * update visibility, uncomment TestBuildInfoParser usage * [CI] Auto commit changes from spotless * Factor out createPolicyManager to help merge * TestEntitlementInitialization is not yet implemented * Respond to PR comments --------- Co-authored-by: Lorenzo Dematte <lorenzo.dematte@elastic.co> Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> --------- Co-authored-by: Lorenzo Dematte <lorenzo.dematte@elastic.co> Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
…ses (elastic#128625) * Initialization class as argument to EntitlementAgent * visibility changes * WIP: test entitlement bootstrap and initialization classes * Simplify * Moving packages to reduce visibility * adjust visibility * add plugins descriptor + policy parsing * PR comments * update visibility, uncomment TestBuildInfoParser usage * [CI] Auto commit changes from spotless * Factor out createPolicyManager to help merge * TestEntitlementInitialization is not yet implemented * Respond to PR comments --------- Co-authored-by: Lorenzo Dematte <lorenzo.dematte@elastic.co> Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
…ses (elastic#128625) * Initialization class as argument to EntitlementAgent * visibility changes * WIP: test entitlement bootstrap and initialization classes * Simplify * Moving packages to reduce visibility * adjust visibility * add plugins descriptor + policy parsing * PR comments * update visibility, uncomment TestBuildInfoParser usage * [CI] Auto commit changes from spotless * Factor out createPolicyManager to help merge * TestEntitlementInitialization is not yet implemented * Respond to PR comments --------- Co-authored-by: Lorenzo Dematte <lorenzo.dematte@elastic.co> Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Entitlement bootstrap and initialization for tests.
It loads the agent, use the TestBuildInfo files to create a test ScopeResolver and to locate and load policies and descriptors for plugins and server.
To be used in
BootstrapForTesting
.(Continuation of #127814, merged with main, and including some tweaks we discussed.)