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

[ResponseOps][Rules] Fix rules list item enabled state updates causing test flakyness #183805

Merged
merged 4 commits into from
May 21, 2024

Conversation

umbopepato
Copy link
Member

@umbopepato umbopepato commented May 20, 2024

Summary

Removes optimistic updates from rules list item when enabling/disabling rules to avoid out-of-sync states (the likely cause of this flaky test).

Fixes #157623

@umbopepato umbopepato force-pushed the 157623-rules-list-flaky-test branch from 1af9586 to 4fbed12 Compare May 20, 2024 07:31
@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

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

[✅] x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/config.ts: 50/50 tests passed.

see run history

@umbopepato umbopepato force-pushed the 157623-rules-list-flaky-test branch from 4fbed12 to 925ed14 Compare May 20, 2024 08:28
@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

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

[✅] x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/config.ts: 50/50 tests passed.

see run history

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

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

[✅] x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/config.ts: 100/100 tests passed.

see run history

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🟠 Some tests failed. - kibana-flaky-test-suite-runner#6041

[❌] x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/config.ts: 174/200 tests passed.

see run history

@umbopepato umbopepato force-pushed the 157623-rules-list-flaky-test branch from 925ed14 to a9adc01 Compare May 20, 2024 13:21
@umbopepato umbopepato changed the title Flaky test investigation [ResponseOps][Rules] Fix rules list item enabled state updates causing test flakyness May 20, 2024
@umbopepato
Copy link
Member Author

/ci

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

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

[✅] x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/config.ts: 50/50 tests passed.

see run history

@umbopepato umbopepato added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) labels May 21, 2024
@umbopepato umbopepato marked this pull request as ready for review May 21, 2024 06:48
@umbopepato umbopepato requested a review from a team as a code owner May 21, 2024 06:48
@elasticmachine
Copy link
Contributor

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

@@ -60,7 +60,6 @@ export const RuleStatusDropdown: React.FunctionComponent<ComponentOpts> = ({
hideSnoozeOption = false,
direction = 'column',
}: ComponentOpts) => {
const [isEnabled, setIsEnabled] = useState<boolean>(rule.enabled);
const [isSnoozed, setIsSnoozed] = useState<boolean>(!hideSnoozeOption && isRuleSnoozed(rule));
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Could isSnoozed be also removed from useEffect and handled same way as isEnabled?

Copy link
Member

Choose a reason for hiding this comment

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

I agree with Janki! We can derive the state from the props when the component is rendered.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, I quickly went through the setIsSnoozed usages and concluded it wasn't necessary since the data flow is unidirectional from rule, but a useMemo would be much better at handling this, commit coming in a few minutes 🙂

Copy link
Member

Choose a reason for hiding this comment

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

Not even a useMemo 🙂. const isSnoozed = !hideSnoozeOption && isRuleSnoozed(rule) is more than enough!

Copy link
Contributor

@js-jankisalvi js-jankisalvi left a comment

Choose a reason for hiding this comment

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

Nice catch! LGTM 👍

@umbopepato umbopepato force-pushed the 157623-rules-list-flaky-test branch from 594383d to 15ee943 Compare May 21, 2024 09:20
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

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
triggersActionsUi 1.6MB 1.6MB -318.0B

History

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

@umbopepato umbopepato merged commit 46c8a99 into elastic:main May 21, 2024
21 checks passed
@kibanamachine kibanamachine added v8.15.0 backport:skip This commit does not require backporting labels May 21, 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 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
6 participants