-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[SOR] use initialNamespaces when checking for conflict for create
and bulkCreate
#111023
[SOR] use initialNamespaces when checking for conflict for create
and bulkCreate
#111023
Conversation
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, couple of nits below. Thanks for fixing this 🙏
@@ -778,6 +790,54 @@ describe('SavedObjectsRepository', () => { | |||
}); | |||
}); | |||
|
|||
it(`returns error when there is a conflict with an existing multi-namespace saved object with initialNamespaces (get)`, async () => { |
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.
it(`returns error when there is a conflict with an existing multi-namespace saved object with initialNamespaces (get)`, async () => { | |
it(`returns error when there is an unresolvable conflict with an existing multi-namespace saved object when using initialNamespaces (get)`, async () => { |
@@ -2160,6 +2220,22 @@ describe('SavedObjectsRepository', () => { | |||
expect(client.get).toHaveBeenCalled(); | |||
}); | |||
|
|||
it(`throws when there is a conflict with an existing multi-namespace saved object when using initialNamespaces (get)`, async () => { |
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.
it(`throws when there is a conflict with an existing multi-namespace saved object when using initialNamespaces (get)`, async () => { | |
it(`throws when there is an unresolvable conflict with an existing multi-namespace saved object when using initialNamespaces (get)`, async () => { |
} | ||
const namespaceId = namespaces[0] === 'default' ? undefined : namespaces[0]; | ||
|
||
// const namespaceId = objectNamespace === 'default' ? undefined : objectNamespace ?? namespace; |
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.
Did you forget to delete this?
// const namespaceId = objectNamespace === 'default' ? undefined : objectNamespace ?? namespace; |
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 sure did !
Note: I would say we should backport this to 7.15, but it depends on #109967 which was only backported to 7.16. Edit: then again, it only affects multi-ns objects, of which we only have ML jobs in 7.x, so maybe it's not a big deal if we don't fix this in 7.15. |
⏳ Build in-progress, with failures
To update your PR or re-run it, just comment with: |
retest |
…-initialNamespaces
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
Pinging @elastic/kibana-core (Team:Core) |
@@ -2140,12 +2150,18 @@ export class SavedObjectsRepository { | |||
* @param type The type of the saved object. | |||
* @param id The ID of the saved object. | |||
* @param namespace The target namespace. | |||
* @param initialNamespaces The target namespace(s) we intend to create the object in, if specified. |
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: The difference between namespace
and initialNamespaces
is subtle and it might be worth adding a bit more info here about when each is used.
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.
A small (very optional) nit, otherwise thanks for getting this done so quickly!
LGTM
…nd `bulkCreate` (elastic#111023) * use initialNamespaces when checking for conflict * nits
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…eporting-to-v2 * 'master' of github.com:elastic/kibana: (65 commits) Move to vis_types folder part 2 (elastic#110574) [SOR] use initialNamespaces when checking for conflict for `create` and `bulkCreate` (elastic#111023) [Discover] Remove export* syntax (elastic#110934) [Event log][7.x] Updated event log client to search across legacy IDs (elastic#109365) [Security Solution][Detection Rules] Changes 'activated' text on rule details page (elastic#111044) [Metrics UI] Filter out APM nodes from the inventory view (elastic#110300) [package testing] Update logging and pid configuration (elastic#111059) [Dashboard] Read App State from URL on Soft Refresh (elastic#109354) Add correct roles to test user for functional tests in dashboard (elastic#110880) [DOCS] Adds Lens Inspector and minor edits (elastic#109736) [DOCS] Updates Spaces page (elastic#111005) normalize initialNamespaces (elastic#110936) [Reporting] Clean up `any` usage, reorganize server route files (elastic#110740) [Security Solution] [CTI] Fixes bug that caused Threshold and Indicator Match rules to ignore custom rule filters if a saved query was used in the rule definition. (elastic#109253) skip flaky suites: elastic#111001, elastic#111022 [Security Solution][RAC] - Update reason field text (elastic#110308) [RAC][Security Solution] Make analyzer work with EuiDataGrid full screen (elastic#110913) [Metrics UI] Add integration tests for Metric Threshold Rule and refactor to fire correctly (elastic#109971) [DOCS] Updates Discover docs (elastic#110346) [RAC] Persistent timeline fields fix (elastic#110685) ...
Summary
Found during #109196
Uses
object.initialNamespaces
when present, instead of the providednamespace
, when checking for conflicts duringcreate
andbulkCreate
operationsChecklist