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

[Cases] Fix flaky hooks #183721

Merged
merged 1 commit into from
May 17, 2024
Merged

[Cases] Fix flaky hooks #183721

merged 1 commit into from
May 17, 2024

Conversation

cnasikas
Copy link
Member

Summary

Fixes: #183144, #182845

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@cnasikas cnasikas added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Cases Cases feature v8.15.0 labels May 17, 2024
@cnasikas cnasikas self-assigned this May 17, 2024
@cnasikas cnasikas requested a review from a team as a code owner May 17, 2024 10:40
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops-cases (Feature:Cases)

Comment on lines +42 to +44
await waitFor(() => {
expect(spy).toHaveBeenCalled();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
await waitFor(() => {
expect(spy).toHaveBeenCalled();
});
await waitFor(() => {
expect(spy).toHaveBeenCalledWith({
http,
signal: expect.anything(),
connectorId: connector.id,
});
});

and remove line 46 and below?

Copy link
Member Author

Choose a reason for hiding this comment

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

I do this because if we have the toHaveBeenCalledWith inside the waitFor, we do not know if the expect failed because the function did not get called with the correct arguments or did not call at all. The logs will not show anything in the CI. This way, in the case of a flaky test, the logs will show the expected args.

Comment on lines +43 to +45
await waitFor(() => {
expect(spyOnGetCurrentUserProfile).toBeCalled();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above(removing line 47)

Suggested change
await waitFor(() => {
expect(spyOnGetCurrentUserProfile).toBeCalled();
});
await waitFor(() => {
expect(spyOnGetCurrentUserProfile).toBeCalledWith({
security: expect.anything(),
});
});

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

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

cc @cnasikas

@cnasikas cnasikas merged commit 0e112e3 into elastic:main May 17, 2024
30 checks passed
@cnasikas cnasikas deleted the fix_hooks_flaky branch May 17, 2024 14:01
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label May 17, 2024
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 Feature:Cases Cases feature release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.15.0
Projects
None yet
5 participants