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

[kbn-test] call Kibana API to fetch current user profile #186279

Conversation

dmlemeshko
Copy link
Member

@dmlemeshko dmlemeshko commented Jun 17, 2024

Related to #185870

In this PR I move user_profile fetching out of SAML session creation to its sessionManager.getUserData():

  • rely on Kibana Security API for both local/Kibana CI and MKI cases (currently it is cloud and cached on saml session creation)
  • do not cache profile data in test service, Kibana API is fast enough

I deleted the tests that no longer relevant

@dmlemeshko dmlemeshko requested review from a team as code owners June 17, 2024 10:52
@dmlemeshko
Copy link
Member Author

/ci

@dmlemeshko dmlemeshko added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting v8.15.0 labels Jun 17, 2024
Copy link
Member

@wayneseymour wayneseymour left a comment

Choose a reason for hiding this comment

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

I did add a couple of questions, but LGTM.


test(`'getUserData' should call security API and return user profile data`, async () => {
const testData: UserProfile = {
username: '6ta90xc',
Copy link
Member

Choose a reason for hiding this comment

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

Is this a hashed value or smth?

Copy link
Member Author

Choose a reason for hiding this comment

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

Cloud generates unique string so I just put a random one. The most important to show it is not related to role/email/full name

@@ -117,6 +134,15 @@ describe('SamlSessionManager', () => {

test(`doesn't throw error when supportedRoles is not defined`, async () => {
const nonExistingRole = 'tester';
const testData: UserProfile = {
username: '6ta90xc',
Copy link
Member

Choose a reason for hiding this comment

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

Same as above? What is this value?

Copy link
Member Author

Choose a reason for hiding this comment

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

just random string, user has no control over it.

Copy link
Member

Choose a reason for hiding this comment

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

ah got it, thanks mate!

@dmlemeshko
Copy link
Member Author

/ci

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #36 / serverless observability UI Dataset Quality Dataset quality table shows the last activity when in time range

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/test 265 267 +2

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/test 12 13 +1
Unknown metric groups

API count

id before after diff
@kbn/test 313 315 +2

History

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

@dmlemeshko dmlemeshko merged commit dce29e2 into elastic:main Jun 17, 2024
19 checks passed
nikitaindik pushed a commit to nikitaindik/kibana that referenced this pull request Jun 18, 2024
)

Related to elastic#185870

In this PR I move user_profile fetching out of SAML session creation to
its `sessionManager.getUserData()`:
- rely on Kibana Security API for both local/Kibana CI and MKI cases
(currently it is cloud and cached on saml session creation)
- do not cache profile data in test service, Kibana API is fast enough

I deleted the tests that no longer relevant
@dmlemeshko dmlemeshko deleted the kbn-test/always-call-security-api-for-user-profile branch July 17, 2024 15:12
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.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants