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 template creation tests #173206

Conversation

janmonschke
Copy link
Contributor

@janmonschke janmonschke commented Dec 12, 2023

Summary

Fixes #165738

Fixes the flaky timeline template tests. Some of the test code wasn't valid anymore (e.g. notes in timeline templates), so I removed those and cleaned up the now unnecessary code.

Flaky test runner results (flaky runner results before requested changes)

@janmonschke janmonschke self-assigned this Dec 12, 2023
@janmonschke janmonschke added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Investigations Team labels Dec 12, 2023
@janmonschke janmonschke marked this pull request as ready for review December 13, 2023 09:14
@janmonschke janmonschke requested a review from a team as a code owner December 13, 2023 09:14
describe('Timeline Templates', { tags: ['@ess', '@serverless'] }, () => {
beforeEach(() => {
login();
deleteTimelines();
cy.intercept('PATCH', '/api/timeline').as('timeline');
});

it.skip('Creates a timeline template', () => {
it('Creates a timeline template', () => {
createTimeline(getTimeline());
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to create a regular timeline before creating a template?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch. I must've copy pasted it from the other test. Fixed in 2f23f20

describe('Timeline Templates', { tags: ['@ess', '@serverless'] }, () => {
beforeEach(() => {
login();
deleteTimelines();
cy.intercept('PATCH', '/api/timeline').as('timeline');
});

it.skip('Creates a timeline template', () => {
it('Creates a timeline template', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I get the purpose of this test to kind of test the majority of the timeline template functionality, but do you think it's worth breaking this apart to

describe('Timeline templates', { tags: ['@ess', '@serverless'] }, () => {
 test('should be able to create a template', () => {});
  test('should be able to be save a template', () => { }); 
  test('should be able to update a template', () => {});
});

or something similarly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would rather test this in one test so that we don't create dependencies between tests or duplicate a lot of the creation code.

To make more sense of the logic and in order to make it easier to debug on the CI, I added a couple of cy.logs. Let me know if that's better. da5e697

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense and I understand why. In this scenario I would have suggested putting the creation in a beforeAll and then still breaking the tests apart, but with cypress not running the beforeAll on retries could make those flaky and not make true independent tests. All that being said, this may be the best compromise.

@michaelolo24
Copy link
Contributor

Do you mind doing flaky test run for serverless as well since these tests run on serverless, thanks!

@janmonschke
Copy link
Contributor Author

Do you mind doing flaky test run for serverless as well since these tests run on serverless, thanks!

@michaelolo24 The flaky test runner was run on both ESS and severless: https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4520

@michaelolo24
Copy link
Contributor

Do you mind doing flaky test run for serverless as well since these tests run on serverless, thanks!

@michaelolo24 The flaky test runner was run on both ESS and severless: https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4520

Missed that, thanks!

cy.get(TIMELINE_TITLE).should('have.text', getTimeline().title);
cy.get(TIMELINE_DESCRIPTION).should('have.text', getTimeline().description);
cy.get(TIMELINE_QUERY).should('have.text', getTimeline().query);
cy.get(TIMELINE_QUERY).should('contain.text', getTimeline().query);
// Comments this assertion until we agreed what to do with the filters.
// cy.get(TIMELINE_FILTER(timeline.filter)).should('exist');
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we remove this comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, let's do that :) c7c270d

Copy link
Contributor

@michaelolo24 michaelolo24 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 updating and fixing this test!

@janmonschke
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

kibana-ci commented Dec 14, 2023

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Defend Workflows Cypress Tests #12 / Response console From Alerts should open responder from timeline view alert details flyout should open responder from timeline view alert details flyout
  • [job] [logs] Jest Integration Tests #4 / when splitting .kibana into multiple indices and one clone fails after resolving the problem and retrying the migration completes successfully

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 13.1MB 13.1MB +3.0B

History

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

cc @janmonschke

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
4 participants