Skip to content

Conversation

@cwperks
Copy link
Member

@cwperks cwperks commented Dec 23, 2024

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 of Collection<Class<? extends Plugin>> which allows for configuring additional settings like extendedPlugins.

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 the extendedPlugins keyword 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

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

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.

@github-actions
Copy link
Contributor

❌ 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?

@reta
Copy link
Contributor

reta commented Apr 29, 2025

@reta Any concerns on this PR? I'd like to enable testing for extended plugins.

Thanks @cwperks , it is definitely on the right track, I believe that we should be using PluginInfo (not maps Plugin <-> Plugin, ...) to express all the dependency between plugins - this is how it is going to be used anyway, thank you

@cwperks cwperks requested a review from a team as a code owner May 6, 2025 19:38
@cwperks
Copy link
Member Author

cwperks commented May 6, 2025

Thanks @cwperks , it is definitely on the right track, I believe that we should be using PluginInfo (not maps Plugin <-> Plugin, ...) to express all the dependency between plugins - this is how it is going to be used anyway, thank you

Its a little more complicated then that. It would be used by a subclass of OpenSearchIntegTestCase overriding the extendedPlugins() method..similar to how it works for general classpathPlugins by overriding the nodePlugins() method.

@github-actions
Copy link
Contributor

github-actions bot commented May 6, 2025

✅ Gradle check result for 0ee15a4: SUCCESS

@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2025

❌ 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]>
@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2025

❌ 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?

cwperks added 2 commits May 7, 2025 21:18
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented May 8, 2025

✅ Gradle check result for 3c3b621: SUCCESS

@cwperks cwperks merged commit fb77cc7 into opensearch-project:main May 8, 2025
30 checks passed
neuenfeldttj pushed a commit to neuenfeldttj/OpenSearch that referenced this pull request Jun 26, 2025
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants