Skip to content
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

Adds tests to ensure registered SO types aren't removed #207142

Merged
merged 7 commits into from
Jan 22, 2025

Conversation

TinaHeiligers
Copy link
Contributor

fix #207128

We have an integration test to check that saved objects aren't removed and another that catches mappings changes.
This PR adds another assertion to ensure that the message is clear: Removing a saved object type is not allowed after 8.8.

@TinaHeiligers TinaHeiligers added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting labels Jan 17, 2025
@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream


// set minimum number of registered saved objects to ensure no object types are removed after 8.8
// declared in internal implementation exclicilty to prevent unintended changes.
export const MIN_SAVED_OBJECT_TYPES_COUNT = 127 as const;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exporting the constant from an internal package on purpose to avoid messing with the public types.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT we're comparing for equalty, so perhaps this should be called SAVED_OBJECT_TYPES_COUNT.
I suppose that folks will have to update this const every time they add a new type, which is a good thing, cause the description next to it tells us that it cannot go down.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 5dc727a

@@ -46,6 +47,8 @@ describe('checking migration metadata changes on all registered SO types', () =>
// This test is meant to fail when any change is made in registered types that could potentially impact the SO migration.
// Just update the snapshot by running this test file via jest_integration with `-u` and push the update.
// The intent is to trigger a code review from the Core team to review the SO type changes.
// The number of types in the hashMap should never be reduced, it can only increase.
// Removing saved object types is forbidden after 8.8.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These comments are ment to warn against removing saved object types for anyone who ends up having to make changes to the tests to get them to pass.

'<rootDir>/src/core/server/integration_tests/saved_objects/routes',
'<rootDir>/src/core/server/integration_tests/saved_objects/service',
'<rootDir>/src/core/server/integration_tests/saved_objects/validation',
'<rootDir>/src/core/server/integration_tests/saved_objects/registration',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the type_registration to its own subfolder because it was getting "lost" within group3 in the migrations integration tests.

Copy link
Contributor Author

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self review

@TinaHeiligers TinaHeiligers marked this pull request as ready for review January 18, 2025 01:22
@TinaHeiligers TinaHeiligers requested a review from a team as a code owner January 18, 2025 01:22
@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #5 / Policy Advanced Settings section should expand and collapse section when button is clicked

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/core-saved-objects-server-internal 74 75 +1
Unknown metric groups

API count

id before after diff
@kbn/core-saved-objects-server-internal 75 76 +1

History

@TinaHeiligers TinaHeiligers merged commit c63bdb6 into elastic:main Jan 22, 2025
8 checks passed
viduni94 pushed a commit to viduni94/kibana that referenced this pull request Jan 23, 2025
fix elastic#207128

We have an integration test to check that saved objects aren't removed
and another that catches mappings changes.
This PR adds another assertion to ensure that the message is clear:
Removing a saved object type is not allowed after 8.8.

---------

Co-authored-by: Elastic Machine <[email protected]>
qn895 pushed a commit to qn895/kibana that referenced this pull request Jan 23, 2025
fix elastic#207128

We have an integration test to check that saved objects aren't removed
and another that catches mappings changes.
This PR adds another assertion to ensure that the message is clear:
Removing a saved object type is not allowed after 8.8.

---------

Co-authored-by: Elastic Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Saved Objects] ensure no types are removed
4 participants