Skip to content

Commit

Permalink
Merge branch 'improvement/fix-unit-test-flakiness' into q/123.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bert-e committed Jul 12, 2022
2 parents 00e86b1 + 85855bc commit e23dc04
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions ui/src/containers/AlertHistoryProvider.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { setupServer } from 'msw/node';
import { rest } from 'msw';
import { MetricsTimeSpanProvider } from '@scality/core-ui/dist/next';
import AlertHistoryProvider, { useHistoryAlerts } from './AlertHistoryProvider';
import { FAKE_CONTROL_PLANE_IP, waitFor } from '../components/__TEST__/util';
import { FAKE_CONTROL_PLANE_IP } from '../components/__TEST__/util';
import { makeQueryRangeResult } from '../../cypress/support/mockUtils';
import { initialize as initializeProm } from '../services/prometheus/api';
import { initialize as initializeAM } from '../services/alertmanager/api';
Expand All @@ -14,7 +14,17 @@ import StartTimeProvider from './StartTimeProvider';

const wrapper = ({ children }) => (
<MemoryRouter>
<QueryClientProvider client={new QueryClient()}>
<QueryClientProvider
client={
new QueryClient({
defaultOptions: {
queries: {
retry: false,
},
},
})
}
>
<MetricsTimeSpanProvider>
<StartTimeProvider>
<AlertHistoryProvider>{children}</AlertHistoryProvider>
Expand Down Expand Up @@ -431,7 +441,7 @@ describe('useHistoryAlerts', () => {
});

it('should retrieve alert history', async () => {
const { result } = renderHook(
const { result, waitFor } = renderHook(
() => useHistoryAlerts({ alertname: 'ClusterDegraded' }),
{ wrapper },
);
Expand Down

0 comments on commit e23dc04

Please sign in to comment.