Harden migrate tests for single-provider (no typeField) resources - #6454
Open
DarshitChanpura wants to merge 2 commits into
Open
Harden migrate tests for single-provider (no typeField) resources#6454DarshitChanpura wants to merge 2 commits into
DarshitChanpura wants to merge 2 commits into
Conversation
Adds regression coverage for the resource-sharing migrate path used by plugins that register a single provider with no typeField (for example, notifications' notification_config): - classifyDocType falls back to the sole default_access_level key, so such docs are classified and migrated rather than skipped. - username_path must be a valid non-empty path (empty is rejected by the path validator), and a non-resolving path yields no owner so migration attributes ownership to default_owner, while backend_roles_path still supplies the shared backend roles. Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
DarshitChanpura
requested review from
Rishav9852Kumar,
RyanL1997,
cwperks,
derek-ho,
finnegancarroll,
nibix,
reta,
shikharj05 and
willyborankin
as code owners
September 1, 2026 21:48
Contributor
PR Reviewer Guide 🔍(Review updated until commit d35bb2f)Here are some key observations to aid the review process:
|
Contributor
|
Persistent review updated to latest commit d35bb2f |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6454 +/- ##
==========================================
+ Coverage 75.74% 75.75% +0.01%
==========================================
Files 457 457
Lines 30512 30508 -4
Branches 4615 4615
==========================================
+ Hits 23110 23111 +1
+ Misses 5284 5277 -7
- Partials 2118 2120 +2 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Adds regression coverage for the resource-sharing migrate path used by plugins that register a single
ResourceProviderwith notypeField(for example, notifications'notification_config). This behavior currently has no unit coverage; the tests lock it so a future change toclassifyDocTypeor the request-path validation can't silently break migration for these plugins.Two cases:
classifyNotificationConfigFallsBackToSingleAccessLevelKey— with no type paths,classifyDocTypefalls back to the soledefault_access_levelkey, so anotification_configdoc is classified (and migrated) rather than recorded underskippedResources. Uses a faithful.opensearch-notifications-config_source(NotificationConfigDoc.toXContentshape with the realNotificationConstantstag names).nonResolvingUsernamePathYieldsNoOwnerSoMigrationUsesDefaultOwner—username_pathmust be a valid, non-empty path (an empty""is rejected byPATH_VALIDATOR#requireNonEmpty), and a valid non-resolving path yields no owner, so migration attributes ownership todefault_ownerwhilebackend_roles_path(/metadata/access) still supplies the shared backend roles.Test-only; no production change. The live write-path counterpart is already covered by
MigrateApiTests(a resource with no owner migrates intoresourcesWithDefaultOwner).Testing
./gradlew test --tests "org.opensearch.security.resources.api.migrate.MigrateResourceSharingInfoApiActionTests"— 10 passed, 0 failed.Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.