Skip to content

Commit

Permalink
[Cloud Security] Update mock server timeout config (#187119)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
opauloh committed Jun 27, 2024
1 parent 55bbd76 commit 82fb8dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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 });
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 82fb8dc

Please sign in to comment.