[Cloud Security] Update mock server timeout config (#187119)

## Summary

It fixes #186946

This fixes timeout CI errors by setting a higher jest timeout for
integration tests as they are allowed to take more time to run than unit
tests.
This commit is contained in:
Paulo Henrique 2024-06-27 16:37:25 -07:00 committed by GitHub
parent 55bbd76fce
commit 82fb8dca37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 31 deletions

View file

@ -63,12 +63,6 @@ describe('<Findings />', () => {
// Loading while checking the status API
expect(screen.getByText(/loading/i)).toBeInTheDocument();
await waitFor(() =>
expect(screen.getByTestId('latest_findings_container')).toBeInTheDocument()
);
// loading findings
await waitFor(() => expect(screen.getByText(/loading results/i)).toBeInTheDocument());
await waitFor(() => expect(screen.getByText(/2 findings/i)).toBeInTheDocument());
expect(screen.getByText(finding1.resource.name)).toBeInTheDocument();
@ -99,12 +93,6 @@ describe('<Findings />', () => {
// Loading while checking the status API
expect(screen.getByText(/loading/i)).toBeInTheDocument();
await waitFor(() =>
expect(screen.getByTestId('latest_findings_container')).toBeInTheDocument()
);
// loading findings
await waitFor(() => expect(screen.getByText(/loading results/i)).toBeInTheDocument());
await waitFor(() => expect(screen.getByText(/2 findings/i)).toBeInTheDocument());
const queryInput = screen.getByTestId('queryInput');
@ -134,12 +122,6 @@ describe('<Findings />', () => {
// Loading while checking the status API
expect(screen.getByText(/loading/i)).toBeInTheDocument();
await waitFor(() =>
expect(screen.getByTestId('latest_findings_container')).toBeInTheDocument()
);
// loading findings
await waitFor(() => expect(screen.getByText(/loading results/i)).toBeInTheDocument());
await waitFor(() => expect(screen.getByText(/2 findings/i)).toBeInTheDocument());
const queryInput = screen.getByTestId('queryInput');
@ -171,12 +153,6 @@ describe('<Findings />', () => {
// Loading while checking the status API
expect(screen.getByText(/loading/i)).toBeInTheDocument();
await waitFor(() =>
expect(screen.getByTestId('latest_findings_container')).toBeInTheDocument()
);
// loading findings
await waitFor(() => expect(screen.getByText(/loading results/i)).toBeInTheDocument());
await waitFor(() => expect(screen.getByText(/2 findings/i)).toBeInTheDocument());
userEvent.click(screen.getByTestId('addFilter'), undefined, { skipPointerEventsCheck: true });
@ -212,7 +188,7 @@ describe('<Findings />', () => {
await waitFor(() => expect(screen.getByText(/1 findings/i)).toBeInTheDocument());
expect(screen.getByText(finding1.resource.name)).toBeInTheDocument();
expect(screen.queryByText(finding2.resource.id)).not.toBeInTheDocument();
}, 10000);
});
it('remove filter', async () => {
const finding1 = generateCspFinding('0001', 'failed');
const finding2 = generateCspFinding('0002', 'passed');
@ -256,12 +232,6 @@ describe('<Findings />', () => {
// Loading while checking the status API
expect(screen.getByText(/loading/i)).toBeInTheDocument();
await waitFor(() =>
expect(screen.getByTestId('latest_findings_container')).toBeInTheDocument()
);
// loading findings
await waitFor(() => expect(screen.getByText(/loading results/i)).toBeInTheDocument());
await waitFor(() => expect(screen.getByText(/1 findings/i)).toBeInTheDocument());
expect(screen.getByText(finding1.resource.name)).toBeInTheDocument();
expect(screen.queryByText(finding2.resource.id)).not.toBeInTheDocument();

View file

@ -33,6 +33,9 @@ jest.mock('rxjs', () => {
};
});
// Set the default timeout for all mock server tests to 30 seconds
jest.setTimeout(10 * 3000);
/**
* Setup a mock server with the default handlers
* @param debug - If true, log all requests to the console