mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Remove console logs, fix aggregate errors and add missing endpoint
This commit is contained in:
parent
8c313add00
commit
820f4f0ef5
@ -155,6 +155,7 @@ beforeAll(() => {
|
||||
|
||||
describe('RuleList', () => {
|
||||
beforeEach(() => {
|
||||
alertingServer.listen({ onUnhandledRequest: 'error' });
|
||||
grantUserPermissions([
|
||||
AccessControlAction.AlertingRuleRead,
|
||||
AccessControlAction.AlertingRuleUpdate,
|
||||
@ -178,10 +179,15 @@ describe('RuleList', () => {
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
alertingServer.resetHandlers();
|
||||
jest.resetAllMocks();
|
||||
setDataSourceSrv(undefined as unknown as DataSourceSrv);
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
alertingServer.close();
|
||||
});
|
||||
|
||||
it('load & show rule groups from multiple cloud data sources', async () => {
|
||||
mocks.getAllDataSourcesMock.mockReturnValue(Object.values(dataSources));
|
||||
|
||||
@ -571,7 +577,6 @@ describe('RuleList', () => {
|
||||
|
||||
describe('pausing rules', () => {
|
||||
beforeEach(() => {
|
||||
alertingServer.listen({ onUnhandledRequest: 'error' });
|
||||
grantUserPermissions([
|
||||
AccessControlAction.AlertingRuleRead,
|
||||
AccessControlAction.AlertingRuleUpdate,
|
||||
@ -585,12 +590,6 @@ describe('RuleList', () => {
|
||||
Promise.resolve(sourceName === 'grafana' ? pausedPromRules('grafana') : [])
|
||||
);
|
||||
});
|
||||
afterEach(() => {
|
||||
alertingServer.resetHandlers();
|
||||
});
|
||||
afterAll(() => {
|
||||
alertingServer.close();
|
||||
});
|
||||
|
||||
test('resuming paused alert rule', async () => {
|
||||
const user = userEvent.setup();
|
||||
@ -602,8 +601,6 @@ describe('RuleList', () => {
|
||||
|
||||
expect(await ui.stateTags.paused.find()).toBeInTheDocument();
|
||||
|
||||
console.log(JSON.stringify(getPotentiallyPausedRulerRules(false), null, 4));
|
||||
|
||||
// TODO: Migrate all testing logic to MSW and so we aren't manually tweaking the API response behaviour
|
||||
mocks.api.fetchRulerRules.mockImplementationOnce(() => {
|
||||
return Promise.resolve(getPotentiallyPausedRulerRules(false));
|
||||
|
@ -17,6 +17,10 @@ const alertingServer = setupServer(
|
||||
http.get('/api/v1/ngalert', () => {
|
||||
return HttpResponse.json({ alertmanagersChoice: 'all', numExternalAlertmanagers: 1 });
|
||||
}),
|
||||
// TODO: Scaffold out test behaviour/configuration for plugins / incident endpoint
|
||||
http.get('/api/plugins/grafana-incident-app/settings', () => {
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
}),
|
||||
|
||||
http.get('/api/folders/:folderUid', () => {
|
||||
return HttpResponse.json({
|
||||
@ -30,9 +34,6 @@ const alertingServer = setupServer(
|
||||
return HttpResponse.json([]);
|
||||
}),
|
||||
http.post('/api/ruler/grafana/api/v1/rules/:namespaceUID/', async ({ request }) => {
|
||||
console.log('updaint');
|
||||
const body = await request.json();
|
||||
console.log(JSON.stringify(body, null, 2));
|
||||
return HttpResponse.json({
|
||||
message: 'rule group updated successfully',
|
||||
updated: ['foo', 'bar', 'baz'],
|
||||
|
Loading…
Reference in New Issue
Block a user