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

[ftr] migrating 'management/ingest_pipelines' API integration test to deployment-agnostic one #192063

Conversation

dmlemeshko
Copy link
Member

@dmlemeshko dmlemeshko commented Sep 4, 2024

Summary

The goal is to consolidate 2 existing test files with identical logic into a single, deployment-agnostic test file:

Files to be replaced:

  • x-pack/test/api_integration/apis/management/ingest_pipelines/ingest_pipelines.ts
  • x-pack/test_serverless/api_integration/test_suites/common/management/ingest_pipelines.ts

New test file:

  • x-pack/test/api_integration/deployment_agnostic/apis/management/ingest_pipelines.ts

The migration leverages the serverless test file as a basis for the new deployment-agnostic test.
Necessary modifications are minimal and include FTR context provider & its services to ensure compatibility across different environments.
Lastly new file has to be loaded into both the serverless and stateful config files under x-pack/test/api_integration/deployment_agnostic/configs

This approach ensures that the test logic remains consistent while reducing redundancy and maintaince effort.

@dmlemeshko dmlemeshko added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting v8.16.0 labels Sep 4, 2024
@dmlemeshko dmlemeshko marked this pull request as ready for review September 4, 2024 10:43
@dmlemeshko dmlemeshko requested review from a team as code owners September 4, 2024 10:43
Copy link
Contributor

@ElenaStoeva ElenaStoeva left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @dmlemeshko!

This approach makes sense to me. 👍 Were the ingest pipelines tests the only management tests that are identical in serverless and stateful?

Changes lgtm with two small comments/questions.

.post(ingestPipelines.fixtures.apiBasePath)
.set('kbn-xsrf', 'xxx')
.send(pipelineRequestBody)
.expect(200);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we keep the .expect(200) part?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch!


describe('Ingest Pipelines', function () {
before(async () => {
supertestWithAdminScope = await roleScopedSupertest.getSupertestWithRoleScope('admin', {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this have the same privileges as supertest from the original test? Just wanted to make sure we don't give additional privileges that are not needed.

Copy link
Member Author

@dmlemeshko dmlemeshko Sep 6, 2024

Choose a reason for hiding this comment

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

supertest is inited with system_indices_superuser role, which in stateful grants absolutely "everything". In the past it hided some bugs, and generally it is not recommended to use that role for API calls testing, but create something scoped to the particular functionality.

You can see both role definitions here https://github.com/elastic/kibana/blob/main/packages/kbn-es/src/stateful_resources/roles.yml#L99-L130 , admin is a default Cloud role (Cloud Org admin) and should be able to perform all the possible operations with Kibana.

But if you think ingesting pipeline should be available with lower permissions (editor) , we should definitely change it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for clarifying! I think leaving it with admin role is okay given that the privileges in the original test were even higher. cc: @alisonelizabeth

@dmlemeshko
Copy link
Member Author

dmlemeshko commented Sep 6, 2024

This approach makes sense to me. 👍 Were the ingest pipelines tests the only management tests that are identical in serverless and stateful?

I believe so only looking into x-pack/test_serverless, but you may want to check if any of existing stateful tests in x-pack/test/api_integration/apis/management are covering the same functionality/scenarios available in serverless and migrate them too.
That may help to improve serverless test coverage.

Copy link
Contributor

@ElenaStoeva ElenaStoeva left a comment

Choose a reason for hiding this comment

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

Latest changes lgtm, thanks for addressing my comments!

@ElenaStoeva
Copy link
Contributor

This approach makes sense to me. 👍 Were the ingest pipelines tests the only management tests that are identical in serverless and stateful?

I believe so only looking into x-pack/test_serverless, but you may want to check if any of existing stateful tests in x-pack/test/api_integration/apis/management are covering the same functionality/scenarios available in serverless and migrate them too. That may help to improve serverless test coverage.

I understand... IIRC, for some of the serverless tests we reduced the test cases and only included the most essential test cases from the corresponding stateful tests. We could use this approach to increase the test coverage in serverless for the rest of our plugins - I'll bring this up in our team sync.

Copy link
Member

@pheyos pheyos left a comment

Choose a reason for hiding this comment

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

LGTM

@dmlemeshko
Copy link
Member Author

holding back merging until https://github.com/elastic/qaf-tests/issues/94 is resolved

@dmlemeshko dmlemeshko enabled auto-merge (squash) September 10, 2024 11:07
@dmlemeshko dmlemeshko merged commit 0059081 into elastic:main Sep 10, 2024
21 checks passed
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

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 v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants