Skip to content
代码片段 群组 项目
提交 2862c89d 编辑于 作者: Jose Ivan Vargas's avatar Jose Ivan Vargas
浏览文件

Add an additional check to prevent extra reportToSentry calls

This reduces the amount of times the job logs call Sentry
in the job_log app
上级 551100ac
No related branches found
No related tags found
无相关合并请求
...@@ -282,7 +282,7 @@ export const triggerManualJob = ({ state }, variables) => { ...@@ -282,7 +282,7 @@ export const triggerManualJob = ({ state }, variables) => {
}; };
export const requestTestSummary = ({ state, commit, dispatch }) => { export const requestTestSummary = ({ state, commit, dispatch }) => {
if (!state.testSummaryComplete) { if (!state.testSummaryComplete && state.testReportSummaryUrl?.length) {
axios axios
.get(state.testReportSummaryUrl) .get(state.testReportSummaryUrl)
.then(({ data }) => { .then(({ data }) => {
......
...@@ -25,6 +25,7 @@ import { ...@@ -25,6 +25,7 @@ import {
showSidebar, showSidebar,
toggleSidebar, toggleSidebar,
receiveTestSummarySuccess, receiveTestSummarySuccess,
requestTestSummary,
} from '~/ci/job_details/store/actions'; } from '~/ci/job_details/store/actions';
import { isScrolledToBottom } from '~/lib/utils/scroll_utils'; import { isScrolledToBottom } from '~/lib/utils/scroll_utils';
...@@ -32,6 +33,7 @@ import * as types from '~/ci/job_details/store/mutation_types'; ...@@ -32,6 +33,7 @@ import * as types from '~/ci/job_details/store/mutation_types';
import state from '~/ci/job_details/store/state'; import state from '~/ci/job_details/store/state';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_OK } from '~/lib/utils/http_status'; import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_OK } from '~/lib/utils/http_status';
import { testSummaryData } from 'jest/ci/jobs_mock_data';
jest.mock('~/lib/utils/scroll_utils'); jest.mock('~/lib/utils/scroll_utils');
...@@ -555,4 +557,47 @@ describe('Job State actions', () => { ...@@ -555,4 +557,47 @@ describe('Job State actions', () => {
); );
}); });
}); });
describe('requestTestSummary', () => {
let mock;
beforeEach(() => {
mock = new MockAdapter(axios);
});
afterEach(() => {
mock.restore();
stopPolling();
clearEtagPoll();
});
describe('success', () => {
it('dispatches receiveTestSummarySuccess', () => {
mockedState.testReportSummaryUrl = `${TEST_HOST}/test_report_summary.json`;
mock
.onGet(`${TEST_HOST}/test_report_summary.json`)
.replyOnce(HTTP_STATUS_OK, testSummaryData);
return testAction(
requestTestSummary,
null,
mockedState,
[{ type: types.RECEIVE_TEST_SUMMARY_COMPLETE }],
[
{
payload: testSummaryData,
type: 'receiveTestSummarySuccess',
},
],
);
});
});
describe('without testReportSummaryUrl', () => {
it('does not dispatch any actions or mutations', () => {
return testAction(requestTestSummary, null, mockedState, [], []);
});
});
});
}); });
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册