Add ability to test scheduled jobs in the sample resource plugin #5564
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.
Description
This PR extends the sample plugin to also allow this repo to test security behavior with scheduled jobs. There is a prevalent pattern of RolesInjection used across many plugins and I think its about time that we add automated tests in this repo to verify the behavior...especially looking forward to the future of replacing roles injection.
This PR essentially copies the same setup from the job scheduler and adds it to the sample plugin in this repo. Its debatable whether the tests should be in security or in job scheduler, but I'd argue that since the tests are pertinent to security behavior of scheduled jobs that they would be appropriate to add in this repo.
Note: This PR would have a circular dependency with the job-scheduler. i.e. job scheduler depends on security for integ tests and security also depends on the job scheduler for integ tests. I think this should either be permitted or a decision should be made to sever JS' dependency on security for integ tests and rely on this repo to test Job Scheduler behavior when the security plugin is installed.
In either event, my intent here is to making our testing harness increasingly capable to have a richer suite of test cases for common patterns with how plugins integrate with security. It serves demonstration purposes, but also allows us to start writing assertions for intended behaviors inside this repo.
Test Enhancement
Issues Resolved
Would be helpful for writing tests for the fix of opensearch-project/alerting#1829
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.