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

switch from esArchiver to saved objects API for .kibana data in functional tests #89368

Closed
LeeDr opened this issue Jan 26, 2021 · 5 comments
Closed

Comments

@LeeDr
Copy link
Contributor

LeeDr commented Jan 26, 2021

We currently use esArchiver to load both test data and Kibana data (which are saved objects stored in the .kibana index).
We should switch to loading the Kibana data using the saved object API https://www.elastic.co/guide/en/kibana/master/saved-objects-api.html

  1. We advise users NOT to write directly to the .kibana index
    "Do not write documents directly to the .kibana index. When you write directly to the .kibana index, the data becomes corrupted and permanently breaks future Kibana versions."

  2. The saved object API is the recommended way.

  3. When we use esArchiver to load data, it removes everything else first (except the default space). But using the Saved Object API we could potentially choose to add objects to the existing objects.

Back when most of the functional tests were written, we didn't support exporting and importing everything in the .kibana index. I'm not 100% sure if everything is now supported but I think it should be.

The steps to switch from using esArchiver to the SO API would probably be;

  1. Add a line in each test (or index file) where esArchiver is loading a .kibana indexthat exports saved objects
  2. run the tests to get all the exported files
  3. change the tests to
    1. remove the original esArchiver load
    2. add a new step to clear other saved objects out? We need to figure this part out. WARNING: This probably won't come up on the first test. Ideally every test would wipe the existing saved objects and import the set the tests need.
    3. change the SO export to the SO import
  4. run the tests to verify they pass
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-qa (Team:QA)

@wayneseymour
Copy link
Member

Up next: Import the exported data and see if the tests pass, might have to data munge.
After: Investigate hijacking the es_archiver.load fn to export and persist the data.

@wayneseymour
Copy link
Member

Ok, so the first and second pr's are up.
The second pr stands on top of the first and it will take longer to turn around as it's for every test in disover.

@rudolf
Copy link
Contributor

rudolf commented Feb 8, 2021

Back when most of the functional tests were written, we didn't support exporting and importing everything in the .kibana index. I'm not 100% sure if everything is now supported but I think it should be.

We've added all the required building blocks in 7.12 (#90178), but it might take some time for plugins to adopt it and enable their saved objects to be exported.

Some plugins might also choose to use the onExport transform (#87807) to change saved objects when they're exported. These plugins might have to manually edit the ndjson before it can be imported for a test. E.g. alerting will remove all credentials from alerts when they're exported, but these kinds of edge cases can probably continue to use esArchiver.

@rudolf
Copy link
Contributor

rudolf commented Mar 1, 2021

Implemented in #92526

@rudolf rudolf closed this as completed Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment