-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Enable testing for ExtensiblePlugins using classpath plugins #16908
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
Enable testing for ExtensiblePlugins using classpath plugins #16908
Conversation
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
|
❌ Gradle check result for 4176c46: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
test/framework/src/main/java/org/opensearch/test/ExternalTestCluster.java
Outdated
Show resolved
Hide resolved
test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java
Outdated
Show resolved
Hide resolved
Thanks @cwperks , it is definitely on the right track, I believe that we should be using |
Its a little more complicated then that. It would be used by a subclass of |
Signed-off-by: Craig Perkins <[email protected]>
|
❌ Gradle check result for df46482: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Craig Perkins <[email protected]>
server/src/internalClusterTest/java/org/opensearch/plugins/ClasspathPluginIT.java
Outdated
Show resolved
Hide resolved
test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java
Outdated
Show resolved
Hide resolved
test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java
Outdated
Show resolved
Hide resolved
|
❌ Gradle check result for 5cb2929: null Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
…rch-project#16908) * Make extended plugins optional Signed-off-by: Craig Perkins <[email protected]> * Make extended plugins optional Signed-off-by: Craig Perkins <[email protected]> * Load extensions for classpath plugins Signed-off-by: Craig Perkins <[email protected]> * Ensure only single instance for each classpath extension Signed-off-by: Craig Perkins <[email protected]> * Add test for classpath plugin extended plugin loading Signed-off-by: Craig Perkins <[email protected]> * Enable testing for ExtensiblePlugins using classpath plugins Signed-off-by: Craig Perkins <[email protected]> * Add to CHANGELOG Signed-off-by: Craig Perkins <[email protected]> * Define PluginInfos from test files for classpath plugins Signed-off-by: Craig Perkins <[email protected]> * Add testing constructor for PluginsService Signed-off-by: Craig Perkins <[email protected]> * Single call to loadExtensions Signed-off-by: Craig Perkins <[email protected]> * Reduce number of MockNode constructors Signed-off-by: Craig Perkins <[email protected]> * Create 2 public constructors for MockNode Signed-off-by: Craig Perkins <[email protected]> * Update import Signed-off-by: Craig Perkins <[email protected]> * Address code review comments Signed-off-by: Craig Perkins <[email protected]> * Fix logic Signed-off-by: Craig Perkins <[email protected]> * Address PR feedback Signed-off-by: Craig Perkins <[email protected]> * Rename variables Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]>Signed-off-by: TJ Neuenfeldt <[email protected]>
Description
This PR enables testing for ExtensiblePlugins using the classpath plugin pattern present in
internalClusterTest.This PR allows more flexibility in testing by taking in a
Collection<PluginInfo>instead ofCollection<Class<? extends Plugin>>which allows for configuring additional settings likeextendedPlugins.To do this, this PR tries to load all extensions for classpath plugins by defining an extendedPlugin relationship between a classpath plugin and all other classpath plugins. In normal scenarios, a plugin will declare that it extends another plugin through theextendedPluginskeyword that it places in build.gradle (example). This PR also puts logic in place to ensure that any extensions are only loaded once.Additional Context
I ran into this issue while using the integration test framework in the security plugin to test out a change I have been experimenting with. The integration test framework utilizes classpath plugins and it was impossible to load an extensible plugin and its extension simultaneously and have the extensions loaded.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.