diff --git a/public/app/plugins/datasource/graphite/datasource.test.ts b/public/app/plugins/datasource/graphite/datasource.test.ts index da27191be21..ed4a60ce3ee 100644 --- a/public/app/plugins/datasource/graphite/datasource.test.ts +++ b/public/app/plugins/datasource/graphite/datasource.test.ts @@ -183,6 +183,15 @@ describe('graphiteDatasource', () => { describe('when fetching Graphite Events as annotations', () => { let results: any; + let errorSpy: jest.SpyInstance; + + beforeEach(() => { + errorSpy = jest.spyOn(console, 'error').mockImplementation(); + }); + + afterEach(() => { + errorSpy.mockRestore(); + }); const options = { annotation: { @@ -260,6 +269,7 @@ describe('graphiteDatasource', () => { results = data; }); expect(results).toEqual([]); + expect(console.error).toHaveBeenCalledWith(expect.stringMatching(/Unable to get annotations/)); }); }); diff --git a/public/app/plugins/datasource/graphite/specs/store.test.ts b/public/app/plugins/datasource/graphite/specs/store.test.ts index 90e4e063a8b..b0e15713c1e 100644 --- a/public/app/plugins/datasource/graphite/specs/store.test.ts +++ b/public/app/plugins/datasource/graphite/specs/store.test.ts @@ -1,7 +1,6 @@ import { dispatch } from 'app/store/store'; import gfunc from '../gfunc'; import { TemplateSrvStub } from 'test/specs/helpers'; -import { silenceConsoleOutput } from 'test/core/utils/silenceConsoleOutput'; import { actions } from '../state/actions'; import { getAltSegmentsSelectables, @@ -236,7 +235,6 @@ describe('Graphite actions', () => { }); describe('when autocomplete for metric names is not available', () => { - silenceConsoleOutput(); beforeEach(() => { ctx.state.datasource.getTagsAutoComplete = jest.fn().mockReturnValue(Promise.resolve([])); ctx.state.datasource.metricFindQuery = jest.fn().mockReturnValue( @@ -267,7 +265,6 @@ describe('Graphite actions', () => { }); describe('when autocomplete for tags is not available', () => { - silenceConsoleOutput(); beforeEach(() => { ctx.datasource.metricFindQuery = jest.fn().mockReturnValue(Promise.resolve([])); ctx.datasource.getTagsAutoComplete = jest.fn().mockReturnValue( diff --git a/public/app/plugins/datasource/graphite/state/helpers.ts b/public/app/plugins/datasource/graphite/state/helpers.ts index edca103c492..6c235d77280 100644 --- a/public/app/plugins/datasource/graphite/state/helpers.ts +++ b/public/app/plugins/datasource/graphite/state/helpers.ts @@ -172,7 +172,6 @@ export function handleMetricsAutoCompleteError( state: GraphiteQueryEditorState, error: Error ): GraphiteQueryEditorState { - console.error(error); if (!state.metricAutoCompleteErrorShown) { state.metricAutoCompleteErrorShown = true; dispatch(notifyApp(createErrorNotification(`Fetching metrics failed: ${error.message}.`))); @@ -184,7 +183,6 @@ export function handleMetricsAutoCompleteError( * When tags autocomplete fails - the error is shown, but only once per page view */ export function handleTagsAutoCompleteError(state: GraphiteQueryEditorState, error: Error): GraphiteQueryEditorState { - console.error(error); if (!state.tagsAutoCompleteErrorShown) { state.tagsAutoCompleteErrorShown = true; dispatch(notifyApp(createErrorNotification(`Fetching tags failed: ${error.message}.`)));