-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Spike for unusual test timeout for fleet #201443
base: main
Are you sure you want to change the base?
Spike for unusual test timeout for fleet #201443
Conversation
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
act(() => { | ||
fireEvent.click(results.getByTestId('standaloneTab')); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need to wrap fireEvent in act
@@ -23,11 +23,8 @@ import type { FlyOutProps } from './types'; | |||
import { AgentEnrollmentFlyout } from '.'; | |||
|
|||
const render = (props?: Partial<FlyOutProps>) => { | |||
cleanup(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be cleaning up just before test starts, what's more with jest this is handled automatically for us
act(() => { | ||
results = render(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also there's no need to render here, if we still invoke render again in each test suite
@@ -118,7 +118,8 @@ describe('PackagePolicyActionsMenu', () => { | |||
const agentPolicies = createMockAgentPolicies(); | |||
const packagePolicy = createMockPackagePolicy({ hasUpgrade: false }); | |||
const { utils } = renderMenu({ agentPolicies, packagePolicy }); | |||
await act(async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no need to have assertions run within an act function
@@ -129,7 +130,7 @@ describe('PackagePolicyActionsMenu', () => { | |||
const packagePolicy = createMockPackagePolicy({ hasUpgrade: true }); | |||
const { utils } = renderMenu({ agentPolicies, packagePolicy }); | |||
|
|||
await act(async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
1392385
to
fde6dad
Compare
@@ -7,7 +7,7 @@ | |||
|
|||
import React from 'react'; | |||
|
|||
import { act, fireEvent } from '@testing-library/react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
import { createFleetTestRendererMock } from '../../mock'; | ||
|
||
import { RootPrivilegesCallout } from './root_privileges_callout'; | ||
|
||
describe('RootPrivilegesCallout', () => { | ||
function render(rootIntegrations?: Array<{ name: string; title: string }>) { | ||
cleanup(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!deleteRowEl) { | ||
throw new Error('Delete row button not found'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should actually be an assertion
if (deleteRowButtons.length !== 3) { | ||
throw new Error('Delete row buttons not found'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be an assertion
Summary
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breaking
label should be applied in these situations.release_note:*
label is applied per the guidelinesIdentify risks
Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.
Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.