-
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
Fix invalid Reporting integration test data #94616
Fix invalid Reporting integration test data #94616
Conversation
Objects in the Default space should never have a `namespace: 'default'` attribute. This causes a deserialization error when the object is fetched and/or when it is migrated.
💚 Build SucceededMetrics [docs]
To update your PR or re-run it, just comment with: |
Thanks for investigating and fixing this!
I agree that it would make more sense to let
I think the root cause here is that fixtures are edited by hand and then esArchiver writes these directly to the |
😄
OK, I'm happy to add that -- do you think we should add it in this PR, or open a separate one that is only backported to
👍 |
@jportner anything preventing us from merging this? |
Agreed. |
Starting in 7.10, an invalid saved object was introduced into the Reporting API integration test data via #76998:
Excerpt of `x-pack/test/functional/es_archives/reporting/ecommerce_kibana_spaces/data.json.gz` that is currently present in the 7.10, 7.11, and 7.12 branches
Starting in 7.13, this object was updated to include
"migrationVersion": { "config": "7.13.0" }
via #92620 (and the.json.gz
file was replaced with a.json
file):Excerpt of `x-pack/test/functional/es_archives/reporting/ecommerce_kibana_spaces/data.json` that is currently present in the 7.x and master branches
Both of these objects are invalid because they include
"namespace": "default"
, which is not a valid attribute for the object'snamespace
field (it should be undefined to indicate that the object is in the Default space). My best guess for how this occurred is that the test data was exported from Kibana in the first PR linked above, and it was manually modified when being added to the.data.json.gz
file.This invalid object results in the following behavior in the SavedObjectsSerializer:
rawToSavedObject()
: successfully deserializes the document into a saved object with"namespace": "default"
isRawSavedObject()
: returnsfalse
, because the namespace prefix "default" is not found in the object's raw IDHowever,
isRawSavedObject()
is only used during migrations, and the object in question had an up-to-date migrationVersion, therefore it never triggered a migration.We only ran into this test failure because, up until now, the latest migrationVersion for a config object was "7.9.0". However, #93409 introduced a new migration for "7.12.0", which caused the invalid saved object to be migrated during CI in the 7.12 branch, resulting in a test failure.
So we have a few open questions:
rawToSavedObject()
to first check the outcome ofisRawSavedObject()
, and throw an error if the document in question is not a valid raw saved objectCC @lizozom @rudolf