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](combined) update common serverless api tests to use api keys #181741

Merged

Conversation

wayneseymour
Copy link
Member

@wayneseymour wayneseymour commented Apr 25, 2024

Summary

Contributes to: #180834

Update the below common tests, and figure out the minimum required role.

More Info

  • Add type for InternalRequestHeader
  • Add type for SupertestWithoutAuth
  • Add shortcut method: createApiKeyForDefaultRole to Serverless User Manager service
  • Change all calls of await supertest to await supertestWithoutAuth
  • Add Internal Request and Role Credential headers to every await supertestWithoutAuth http call
  • Use the lowest role credential possible for all calls, whether viewer, editor, developer, or admin

Covers these folders:

x-pack/test_serverless/api_integration/test_suites/common/console
x-pack/test_serverless/api_integration/test_suites/common/core
x-pack/test_serverless/api_integration/test_suites/common/data_view_field_editor
x-pack/test_serverless/api_integration/test_suites/common/elasticsearch_api
x-pack/test_serverless/api_integration/test_suites/common/grok_debugger
x-pack/test_serverless/api_integration/test_suites/common/kql_telemetry
x-pack/test_serverless/api_integration/test_suites/common/scripts_tests
x-pack/test_serverless/api_integration/test_suites/common/search_profiler
x-pack/test_serverless/api_integration/test_suites/common/search_xpack

@wayneseymour wayneseymour added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Team:QA Team label for QA Team labels Apr 25, 2024
@wayneseymour wayneseymour self-assigned this Apr 25, 2024
@wayneseymour
Copy link
Member Author

\ci

@wayneseymour wayneseymour force-pushed the update-common-svrless-api-tests/combined branch from fe430a7 to 7975cb4 Compare April 26, 2024 16:24
@wayneseymour
Copy link
Member Author

\ci

1 similar comment
@wayneseymour
Copy link
Member Author

\ci

@wayneseymour wayneseymour force-pushed the update-common-svrless-api-tests/combined branch from 7975cb4 to af3a6c3 Compare May 6, 2024 13:25
@wayneseymour
Copy link
Member Author

\ci

@wayneseymour wayneseymour changed the title [FTR] update common serverless api tests to use api keys [FTR](combined) update common serverless api tests to use api keys May 7, 2024
@wayneseymour
Copy link
Member Author

@wayneseymour wayneseymour marked this pull request as ready for review May 7, 2024 08:43
@wayneseymour wayneseymour requested review from a team as code owners May 7, 2024 08:43
@wayneseymour wayneseymour requested a review from a team as a code owner May 14, 2024 06:08
@wayneseymour
Copy link
Member Author

flaky x25: https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5974

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#5974

[✅] x-pack/test_serverless/api_integration/test_suites/observability/common_configs/config.group1.ts: 25/25 tests passed.

see run history

Copy link
Member

@sabarasaba sabarasaba 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 @wayneseymour! Left few comments, let me know what you think 🚀

Copy link
Member

@dmlemeshko dmlemeshko left a comment

Choose a reason for hiding this comment

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

Great work @wayneseymour I left some non-blocking questions

.expect(200);
expect(body.host).to.be.ok();
await svlUserManager.invalidateApiKeyForRole(roleAuthc);
Copy link
Member

Choose a reason for hiding this comment

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

suggestion : using before / after hooks to generate/invalidate API key; This way we will invalidate key even if it fails

Copy link
Member Author

Choose a reason for hiding this comment

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

.get('/')
.set(svlCommonApi.getCommonRequestHeader())
.set(roleAuthc.apiKeyHeader)
.redirects(2);
Copy link
Member

Choose a reason for hiding this comment

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

question: could you explain why do we need to allow redirects here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Honestly, I do not know.
What I do know, is that the request fails without this, after I added my changes.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, let's double check with code owners here

Copy link
Member Author

Choose a reason for hiding this comment

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

That'd be @pheyos :)

import { FtrProviderContext } from '../../functional/ftr_provider_context';

export type SupertestWithoutAuthType = ProvidedType<typeof SupertestWithoutAuthProvider>;
Copy link
Member

Choose a reason for hiding this comment

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

nice!

Copy link
Member

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

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

no ResponseOps code changes here, near as I can tell - I think there were previously some RO-hitting commits previously ...

Took a quick peek, as it appears the RO changes will be coming in a separate PR - a view of things to come! LGTM

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

cc @wayneseymour

@wayneseymour
Copy link
Member Author

no ResponseOps code changes here, near as I can tell - I think there were previously some RO-hitting commits previously ...

Took a quick peek, as it appears the RO changes will be coming in a separate PR - a view of things to come! LGTM

Thanks Pat!!

@wayneseymour wayneseymour merged commit f50b829 into elastic:main May 15, 2024
18 checks passed
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 Team:QA Team label for QA Team v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants