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

[SecuritySolution] Fix flaky timeline creation tests (role-based issues) #173413

Conversation

janmonschke
Copy link
Contributor

@janmonschke janmonschke commented Dec 14, 2023

Summary

The login as t1_analyst was not working sometimes. In order to reduce flakiness, we moved the role-based login to the test itself.

The flaky test runner also showed that in some cases, we're failing to open the timeline in the tests. The click would perform, but somehow the timeline flyout wouldn't be open. Therefore we added some retry mechanisms to the opening logic (729e5ce).

Also:

  • removes the unnecessary context calls
  • updates the test titles to use the should convention

Flaky test runner result (200/200)

fixes #173339

- removes the unnecessary `context` calls
- updates the test titles to use the `should` convention
@janmonschke janmonschke added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Investigations Team labels Dec 14, 2023
@janmonschke janmonschke self-assigned this Dec 14, 2023
@janmonschke janmonschke changed the title [SecuritySolution] Fix flaky timeline creation tests (role-based isssues) [SecuritySolution] Fix flaky timeline creation tests (role-based issues) Dec 14, 2023
@janmonschke
Copy link
Contributor Author

/ci

@janmonschke janmonschke marked this pull request as ready for review January 8, 2024 14:10
@janmonschke janmonschke requested a review from a team as a code owner January 8, 2024 14:10
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations)

@janmonschke
Copy link
Contributor Author

/ci

Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

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

looks great overall, left a few comments or potential improvements

@@ -126,7 +115,8 @@ describe.skip('Timelines', { tags: ['@ess', '@serverless'] }, (): void => {
.should('have.text', getTimeline().notes);
Copy link
Contributor

Choose a reason for hiding this comment

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

looking at the addNotesToTimeline implementation something is a bit fishy:

  • first the goToNotesTab returns a cy.get but nothing is using that so it could be removed
  • second is at the end of the implementation we navigate to the query tab (goToQueryTab) then back to the notes tab (goToNotesTab). This seems like way too much logic happening in one task...

I think we could extract the getToNotesTab out, so that it's super clear and developers have to intentionally know what they're doing.
Also we should understand why we need to navigate out then back. Is that an issue with the notes tab not refreshing? Is that still necessary?

Copy link
Contributor Author

@janmonschke janmonschke Jan 9, 2024

Choose a reason for hiding this comment

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

first the goToNotesTab returns a cy.get but nothing is using that so it could be removed

I'm not sure what you mean. It's not returning the result of cy.get. It uses it to perform further queries (.find('.euiBadge__text').invoke('text')...)

we navigate to the query tab (goToQueryTab) then back to the notes tab (goToNotesTab)

Yeah, that looks fishy. Let me remove that and see if this has an affect on any of the notes tests. This should not be necessary anymore. That code was added 3 years ago, so a lot has happened since then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing the last two gotos doesn't seem to have an impact on the timeline creation tests neither on the notes tests (which I had to unskip to test)

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what you mean. It's not returning the result of cy.get. It uses it to perform further queries

I meant within the goToNotesTab implementation, the last line returns like this

return cy.get(NOTES_TAB_BUTTON);

but everywhere we call it we call it like that

goToNotesTab();`

so we don't actually use the constant returned. Shouldn't we remove that last return line?

@janmonschke janmonschke marked this pull request as draft January 9, 2024 08:17
@janmonschke janmonschke marked this pull request as ready for review January 9, 2024 16:02
@janmonschke
Copy link
Contributor Author

/ci

Copy link
Contributor

@PhilippeOberti PhilippeOberti 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 making all the changes, code looks great! I left a small comment but if the build is green feel free to ignore and merge. It's not super important and could be done within another PR later!

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #17 / security APIs - Session Concurrent Limit Session Concurrent Limit cleanup should properly clean up sessions that exceeded concurrent session limit even for multiple providers

Metrics [docs]

✅ unchanged

History

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

cc @janmonschke

@PhilippeOberti PhilippeOberti merged commit a100cbb into elastic:main Jan 9, 2024
38 checks passed
@kibanamachine kibanamachine added v8.13.0 backport:skip This commit does not require backporting labels Jan 9, 2024
nreese pushed a commit to nreese/kibana that referenced this pull request Jan 10, 2024
delanni pushed a commit to delanni/kibana that referenced this pull request Jan 11, 2024
janmonschke added a commit that referenced this pull request Jan 11, 2024
## Summary

Unskips the fullscreen timeline tests.

Looking at the issue described in
#172547, it appears that the
timeline was somehow not opening correctly in some cases. This flakiness
has been removed in #173413, so it
should be possible to unskip these tests.

In addition to unskipping the tests, an unnecessary task execution was
removed and two force clicks were cleaned up.

[Flaky test
runner](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4834)
(200/200)

fixes #172547
semd pushed a commit to semd/kibana that referenced this pull request Jan 12, 2024
## Summary

Unskips the fullscreen timeline tests.

Looking at the issue described in
elastic#172547, it appears that the
timeline was somehow not opening correctly in some cases. This flakiness
has been removed in elastic#173413, so it
should be possible to unskip these tests.

In addition to unskipping the tests, an unnecessary task execution was
removed and two force clicks were cleaned up.

[Flaky test
runner](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4834)
(200/200)

fixes elastic#172547
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:Threat Hunting:Investigations Security Solution Investigations Team v8.13.0
Projects
None yet
6 participants