summaryrefslogtreecommitdiff
path: root/spec/frontend/jobs/store
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 08:43:02 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 08:43:02 +0000
commitd9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch)
tree2341ef426af70ad1e289c38036737e04b0aa5007 /spec/frontend/jobs/store
parentd6e514dd13db8947884cd58fe2a9c2a063400a9b (diff)
downloadgitlab-ce-d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb.tar.gz
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'spec/frontend/jobs/store')
-rw-r--r--spec/frontend/jobs/store/actions_spec.js112
-rw-r--r--spec/frontend/jobs/store/getters_spec.js8
-rw-r--r--spec/frontend/jobs/store/mutations_spec.js80
-rw-r--r--spec/frontend/jobs/store/utils_spec.js12
4 files changed, 106 insertions, 106 deletions
diff --git a/spec/frontend/jobs/store/actions_spec.js b/spec/frontend/jobs/store/actions_spec.js
index a29bd15099f..16448d6a3ca 100644
--- a/spec/frontend/jobs/store/actions_spec.js
+++ b/spec/frontend/jobs/store/actions_spec.js
@@ -3,7 +3,7 @@ import { TEST_HOST } from 'helpers/test_constants';
import testAction from 'helpers/vuex_action_helper';
import {
setJobEndpoint,
- setTraceOptions,
+ setJobLogOptions,
clearEtagPoll,
stopPolling,
requestJob,
@@ -12,12 +12,12 @@ import {
receiveJobError,
scrollTop,
scrollBottom,
- requestTrace,
- fetchTrace,
- startPollingTrace,
- stopPollingTrace,
- receiveTraceSuccess,
- receiveTraceError,
+ requestJobLog,
+ fetchJobLog,
+ startPollingJobLog,
+ stopPollingJobLog,
+ receiveJobLogSuccess,
+ receiveJobLogError,
toggleCollapsibleLine,
requestJobsForStage,
fetchJobsForStage,
@@ -51,13 +51,13 @@ describe('Job State actions', () => {
});
});
- describe('setTraceOptions', () => {
- it('should commit SET_TRACE_OPTIONS mutation', (done) => {
+ describe('setJobLogOptions', () => {
+ it('should commit SET_JOB_LOG_OPTIONS mutation', (done) => {
testAction(
- setTraceOptions,
+ setJobLogOptions,
{ pagePath: 'job/872324/trace.json' },
mockedState,
- [{ type: types.SET_TRACE_OPTIONS, payload: { pagePath: 'job/872324/trace.json' } }],
+ [{ type: types.SET_JOB_LOG_OPTIONS, payload: { pagePath: 'job/872324/trace.json' } }],
[],
done,
);
@@ -191,17 +191,17 @@ describe('Job State actions', () => {
});
});
- describe('requestTrace', () => {
- it('should commit REQUEST_TRACE mutation', (done) => {
- testAction(requestTrace, null, mockedState, [{ type: types.REQUEST_TRACE }], [], done);
+ describe('requestJobLog', () => {
+ it('should commit REQUEST_JOB_LOG mutation', (done) => {
+ testAction(requestJobLog, null, mockedState, [{ type: types.REQUEST_JOB_LOG }], [], done);
});
});
- describe('fetchTrace', () => {
+ describe('fetchJobLog', () => {
let mock;
beforeEach(() => {
- mockedState.traceEndpoint = `${TEST_HOST}/endpoint`;
+ mockedState.jobLogEndpoint = `${TEST_HOST}/endpoint`;
mock = new MockAdapter(axios);
});
@@ -212,14 +212,14 @@ describe('Job State actions', () => {
});
describe('success', () => {
- it('dispatches requestTrace, receiveTraceSuccess and stopPollingTrace when job is complete', (done) => {
+ it('dispatches requestJobLog, receiveJobLogSuccess and stopPollingJobLog when job is complete', (done) => {
mock.onGet(`${TEST_HOST}/endpoint/trace.json`).replyOnce(200, {
html: 'I, [2018-08-17T22:57:45.707325 #1841] INFO -- :',
complete: true,
});
testAction(
- fetchTrace,
+ fetchJobLog,
null,
mockedState,
[],
@@ -233,10 +233,10 @@ describe('Job State actions', () => {
html: 'I, [2018-08-17T22:57:45.707325 #1841] INFO -- :',
complete: true,
},
- type: 'receiveTraceSuccess',
+ type: 'receiveJobLogSuccess',
},
{
- type: 'stopPollingTrace',
+ type: 'stopPollingJobLog',
},
],
done,
@@ -244,43 +244,43 @@ describe('Job State actions', () => {
});
describe('when job is incomplete', () => {
- let tracePayload;
+ let jobLogPayload;
beforeEach(() => {
- tracePayload = {
+ jobLogPayload = {
html: 'I, [2018-08-17T22:57:45.707325 #1841] INFO -- :',
complete: false,
};
- mock.onGet(`${TEST_HOST}/endpoint/trace.json`).replyOnce(200, tracePayload);
+ mock.onGet(`${TEST_HOST}/endpoint/trace.json`).replyOnce(200, jobLogPayload);
});
- it('dispatches startPollingTrace', (done) => {
+ it('dispatches startPollingJobLog', (done) => {
testAction(
- fetchTrace,
+ fetchJobLog,
null,
mockedState,
[],
[
{ type: 'toggleScrollisInBottom', payload: true },
- { type: 'receiveTraceSuccess', payload: tracePayload },
- { type: 'startPollingTrace' },
+ { type: 'receiveJobLogSuccess', payload: jobLogPayload },
+ { type: 'startPollingJobLog' },
],
done,
);
});
- it('does not dispatch startPollingTrace when timeout is non-empty', (done) => {
- mockedState.traceTimeout = 1;
+ it('does not dispatch startPollingJobLog when timeout is non-empty', (done) => {
+ mockedState.jobLogTimeout = 1;
testAction(
- fetchTrace,
+ fetchJobLog,
null,
mockedState,
[],
[
{ type: 'toggleScrollisInBottom', payload: true },
- { type: 'receiveTraceSuccess', payload: tracePayload },
+ { type: 'receiveJobLogSuccess', payload: jobLogPayload },
],
done,
);
@@ -293,15 +293,15 @@ describe('Job State actions', () => {
mock.onGet(`${TEST_HOST}/endpoint/trace.json`).reply(500);
});
- it('dispatches requestTrace and receiveTraceError ', (done) => {
+ it('dispatches requestJobLog and receiveJobLogError ', (done) => {
testAction(
- fetchTrace,
+ fetchJobLog,
null,
mockedState,
[],
[
{
- type: 'receiveTraceError',
+ type: 'receiveJobLogError',
},
],
done,
@@ -310,7 +310,7 @@ describe('Job State actions', () => {
});
});
- describe('startPollingTrace', () => {
+ describe('startPollingJobLog', () => {
let dispatch;
let commit;
@@ -318,18 +318,18 @@ describe('Job State actions', () => {
dispatch = jest.fn();
commit = jest.fn();
- startPollingTrace({ dispatch, commit });
+ startPollingJobLog({ dispatch, commit });
});
afterEach(() => {
jest.clearAllTimers();
});
- it('should save the timeout id but not call fetchTrace', () => {
- expect(commit).toHaveBeenCalledWith(types.SET_TRACE_TIMEOUT, expect.any(Number));
+ it('should save the timeout id but not call fetchJobLog', () => {
+ expect(commit).toHaveBeenCalledWith(types.SET_JOB_LOG_TIMEOUT, expect.any(Number));
expect(commit.mock.calls[0][1]).toBeGreaterThan(0);
- expect(dispatch).not.toHaveBeenCalledWith('fetchTrace');
+ expect(dispatch).not.toHaveBeenCalledWith('fetchJobLog');
});
describe('after timeout has passed', () => {
@@ -337,14 +337,14 @@ describe('Job State actions', () => {
jest.advanceTimersByTime(4000);
});
- it('should clear the timeout id and fetchTrace', () => {
- expect(commit).toHaveBeenCalledWith(types.SET_TRACE_TIMEOUT, 0);
- expect(dispatch).toHaveBeenCalledWith('fetchTrace');
+ it('should clear the timeout id and fetchJobLog', () => {
+ expect(commit).toHaveBeenCalledWith(types.SET_JOB_LOG_TIMEOUT, 0);
+ expect(dispatch).toHaveBeenCalledWith('fetchJobLog');
});
});
});
- describe('stopPollingTrace', () => {
+ describe('stopPollingJobLog', () => {
let origTimeout;
beforeEach(() => {
@@ -358,40 +358,40 @@ describe('Job State actions', () => {
window.clearTimeout = origTimeout;
});
- it('should commit STOP_POLLING_TRACE mutation ', (done) => {
- const traceTimeout = 7;
+ it('should commit STOP_POLLING_JOB_LOG mutation ', (done) => {
+ const jobLogTimeout = 7;
testAction(
- stopPollingTrace,
+ stopPollingJobLog,
null,
- { ...mockedState, traceTimeout },
- [{ type: types.SET_TRACE_TIMEOUT, payload: 0 }, { type: types.STOP_POLLING_TRACE }],
+ { ...mockedState, jobLogTimeout },
+ [{ type: types.SET_JOB_LOG_TIMEOUT, payload: 0 }, { type: types.STOP_POLLING_JOB_LOG }],
[],
)
.then(() => {
- expect(window.clearTimeout).toHaveBeenCalledWith(traceTimeout);
+ expect(window.clearTimeout).toHaveBeenCalledWith(jobLogTimeout);
})
.then(done)
.catch(done.fail);
});
});
- describe('receiveTraceSuccess', () => {
- it('should commit RECEIVE_TRACE_SUCCESS mutation ', (done) => {
+ describe('receiveJobLogSuccess', () => {
+ it('should commit RECEIVE_JOB_LOG_SUCCESS mutation ', (done) => {
testAction(
- receiveTraceSuccess,
+ receiveJobLogSuccess,
'hello world',
mockedState,
- [{ type: types.RECEIVE_TRACE_SUCCESS, payload: 'hello world' }],
+ [{ type: types.RECEIVE_JOB_LOG_SUCCESS, payload: 'hello world' }],
[],
done,
);
});
});
- describe('receiveTraceError', () => {
- it('should commit stop polling trace', (done) => {
- testAction(receiveTraceError, null, mockedState, [], [{ type: 'stopPollingTrace' }], done);
+ describe('receiveJobLogError', () => {
+ it('should commit stop polling job log', (done) => {
+ testAction(receiveJobLogError, null, mockedState, [], [{ type: 'stopPollingJobLog' }], done);
});
});
diff --git a/spec/frontend/jobs/store/getters_spec.js b/spec/frontend/jobs/store/getters_spec.js
index 379114c3737..f26c0cf00fd 100644
--- a/spec/frontend/jobs/store/getters_spec.js
+++ b/spec/frontend/jobs/store/getters_spec.js
@@ -102,13 +102,13 @@ describe('Job Store Getters', () => {
});
});
- describe('hasTrace', () => {
+ describe('hasJobLog', () => {
describe('when has_trace is true', () => {
it('returns true', () => {
localState.job.has_trace = true;
localState.job.status = {};
- expect(getters.hasTrace(localState)).toEqual(true);
+ expect(getters.hasJobLog(localState)).toEqual(true);
});
});
@@ -117,7 +117,7 @@ describe('Job Store Getters', () => {
localState.job.has_trace = false;
localState.job.status = { group: 'running' };
- expect(getters.hasTrace(localState)).toEqual(true);
+ expect(getters.hasJobLog(localState)).toEqual(true);
});
});
@@ -126,7 +126,7 @@ describe('Job Store Getters', () => {
localState.job.has_trace = false;
localState.job.status = { group: 'pending' };
- expect(getters.hasTrace(localState)).toEqual(false);
+ expect(getters.hasJobLog(localState)).toEqual(false);
});
});
});
diff --git a/spec/frontend/jobs/store/mutations_spec.js b/spec/frontend/jobs/store/mutations_spec.js
index 159315330e4..b73aa8abf4e 100644
--- a/spec/frontend/jobs/store/mutations_spec.js
+++ b/spec/frontend/jobs/store/mutations_spec.js
@@ -45,39 +45,39 @@ describe('Jobs Store Mutations', () => {
});
});
- describe('RECEIVE_TRACE_SUCCESS', () => {
- describe('when trace has state', () => {
- it('sets traceState', () => {
+ describe('RECEIVE_JOB_LOG_SUCCESS', () => {
+ describe('when job log has state', () => {
+ it('sets jobLogState', () => {
const stateLog =
'eyJvZmZzZXQiOjczNDQ1MSwibl9vcGVuX3RhZ3MiOjAsImZnX2NvbG9yIjpudWxsLCJiZ19jb2xvciI6bnVsbCwic3R5bGVfbWFzayI6MH0=';
- mutations[types.RECEIVE_TRACE_SUCCESS](stateCopy, {
+ mutations[types.RECEIVE_JOB_LOG_SUCCESS](stateCopy, {
state: stateLog,
});
- expect(stateCopy.traceState).toEqual(stateLog);
+ expect(stateCopy.jobLogState).toEqual(stateLog);
});
});
- describe('when traceSize is smaller than the total size', () => {
- it('sets isTraceSizeVisible to true', () => {
- mutations[types.RECEIVE_TRACE_SUCCESS](stateCopy, { total: 51184600, size: 1231 });
+ describe('when jobLogSize is smaller than the total size', () => {
+ it('sets isJobLogSizeVisible to true', () => {
+ mutations[types.RECEIVE_JOB_LOG_SUCCESS](stateCopy, { total: 51184600, size: 1231 });
- expect(stateCopy.isTraceSizeVisible).toEqual(true);
+ expect(stateCopy.isJobLogSizeVisible).toEqual(true);
});
});
- describe('when traceSize is bigger than the total size', () => {
- it('sets isTraceSizeVisible to false', () => {
- const copy = { ...stateCopy, traceSize: 5118460, size: 2321312 };
+ describe('when jobLogSize is bigger than the total size', () => {
+ it('sets isJobLogSizeVisible to false', () => {
+ const copy = { ...stateCopy, jobLogSize: 5118460, size: 2321312 };
- mutations[types.RECEIVE_TRACE_SUCCESS](copy, { total: 511846 });
+ mutations[types.RECEIVE_JOB_LOG_SUCCESS](copy, { total: 511846 });
- expect(copy.isTraceSizeVisible).toEqual(false);
+ expect(copy.isJobLogSizeVisible).toEqual(false);
});
});
- it('sets trace, trace size and isTraceComplete', () => {
- mutations[types.RECEIVE_TRACE_SUCCESS](stateCopy, {
+ it('sets job log size and isJobLogComplete', () => {
+ mutations[types.RECEIVE_JOB_LOG_SUCCESS](stateCopy, {
append: true,
html,
size: 511846,
@@ -85,15 +85,15 @@ describe('Jobs Store Mutations', () => {
lines: [],
});
- expect(stateCopy.traceSize).toEqual(511846);
- expect(stateCopy.isTraceComplete).toEqual(true);
+ expect(stateCopy.jobLogSize).toEqual(511846);
+ expect(stateCopy.isJobLogComplete).toEqual(true);
});
describe('with new job log', () => {
describe('log.lines', () => {
describe('when append is true', () => {
it('sets the parsed log ', () => {
- mutations[types.RECEIVE_TRACE_SUCCESS](stateCopy, {
+ mutations[types.RECEIVE_JOB_LOG_SUCCESS](stateCopy, {
append: true,
size: 511846,
complete: true,
@@ -105,7 +105,7 @@ describe('Jobs Store Mutations', () => {
],
});
- expect(stateCopy.trace).toEqual([
+ expect(stateCopy.jobLog).toEqual([
{
offset: 1,
content: [{ text: 'Running with gitlab-runner 11.12.1 (5a147c92)' }],
@@ -117,7 +117,7 @@ describe('Jobs Store Mutations', () => {
describe('when it is defined', () => {
it('sets the parsed log ', () => {
- mutations[types.RECEIVE_TRACE_SUCCESS](stateCopy, {
+ mutations[types.RECEIVE_JOB_LOG_SUCCESS](stateCopy, {
append: false,
size: 511846,
complete: true,
@@ -126,7 +126,7 @@ describe('Jobs Store Mutations', () => {
],
});
- expect(stateCopy.trace).toEqual([
+ expect(stateCopy.jobLog).toEqual([
{
offset: 0,
content: [{ text: 'Running with gitlab-runner 11.11.1 (5a147c92)' }],
@@ -138,7 +138,7 @@ describe('Jobs Store Mutations', () => {
describe('when it is null', () => {
it('sets the default value', () => {
- mutations[types.RECEIVE_TRACE_SUCCESS](stateCopy, {
+ mutations[types.RECEIVE_JOB_LOG_SUCCESS](stateCopy, {
append: true,
html,
size: 511846,
@@ -146,30 +146,30 @@ describe('Jobs Store Mutations', () => {
lines: null,
});
- expect(stateCopy.trace).toEqual([]);
+ expect(stateCopy.jobLog).toEqual([]);
});
});
});
});
});
- describe('SET_TRACE_TIMEOUT', () => {
- it('sets the traceTimeout id', () => {
+ describe('SET_JOB_LOG_TIMEOUT', () => {
+ it('sets the jobLogTimeout id', () => {
const id = 7;
- expect(stateCopy.traceTimeout).not.toEqual(id);
+ expect(stateCopy.jobLogTimeout).not.toEqual(id);
- mutations[types.SET_TRACE_TIMEOUT](stateCopy, id);
+ mutations[types.SET_JOB_LOG_TIMEOUT](stateCopy, id);
- expect(stateCopy.traceTimeout).toEqual(id);
+ expect(stateCopy.jobLogTimeout).toEqual(id);
});
});
- describe('STOP_POLLING_TRACE', () => {
- it('sets isTraceComplete to true', () => {
- mutations[types.STOP_POLLING_TRACE](stateCopy);
+ describe('STOP_POLLING_JOB_LOG', () => {
+ it('sets isJobLogComplete to true', () => {
+ mutations[types.STOP_POLLING_JOB_LOG](stateCopy);
- expect(stateCopy.isTraceComplete).toEqual(true);
+ expect(stateCopy.isJobLogComplete).toEqual(true);
});
});
@@ -296,12 +296,12 @@ describe('Job Store mutations, feature flag ON', () => {
window.gon = origGon;
});
- describe('RECEIVE_TRACE_SUCCESS', () => {
+ describe('RECEIVE_JOB_LOG_SUCCESS', () => {
describe('with new job log', () => {
describe('log.lines', () => {
describe('when append is true', () => {
it('sets the parsed log ', () => {
- mutations[types.RECEIVE_TRACE_SUCCESS](stateCopy, {
+ mutations[types.RECEIVE_JOB_LOG_SUCCESS](stateCopy, {
append: true,
size: 511846,
complete: true,
@@ -313,7 +313,7 @@ describe('Job Store mutations, feature flag ON', () => {
],
});
- expect(stateCopy.trace).toEqual([
+ expect(stateCopy.jobLog).toEqual([
{
offset: 1,
content: [{ text: 'Running with gitlab-runner 11.12.1 (5a147c92)' }],
@@ -325,7 +325,7 @@ describe('Job Store mutations, feature flag ON', () => {
describe('when lines are defined', () => {
it('sets the parsed log ', () => {
- mutations[types.RECEIVE_TRACE_SUCCESS](stateCopy, {
+ mutations[types.RECEIVE_JOB_LOG_SUCCESS](stateCopy, {
append: false,
size: 511846,
complete: true,
@@ -334,7 +334,7 @@ describe('Job Store mutations, feature flag ON', () => {
],
});
- expect(stateCopy.trace).toEqual([
+ expect(stateCopy.jobLog).toEqual([
{
offset: 0,
content: [{ text: 'Running with gitlab-runner 11.11.1 (5a147c92)' }],
@@ -346,7 +346,7 @@ describe('Job Store mutations, feature flag ON', () => {
describe('when lines are null', () => {
it('sets the default value', () => {
- mutations[types.RECEIVE_TRACE_SUCCESS](stateCopy, {
+ mutations[types.RECEIVE_JOB_LOG_SUCCESS](stateCopy, {
append: true,
html,
size: 511846,
@@ -354,7 +354,7 @@ describe('Job Store mutations, feature flag ON', () => {
lines: null,
});
- expect(stateCopy.trace).toEqual([]);
+ expect(stateCopy.jobLog).toEqual([]);
});
});
});
diff --git a/spec/frontend/jobs/store/utils_spec.js b/spec/frontend/jobs/store/utils_spec.js
index 0c5fa150002..92ac33c8792 100644
--- a/spec/frontend/jobs/store/utils_spec.js
+++ b/spec/frontend/jobs/store/utils_spec.js
@@ -1,7 +1,7 @@
import {
logLinesParser,
logLinesParserLegacy,
- updateIncrementalTrace,
+ updateIncrementalJobLog,
parseHeaderLine,
parseLine,
addDurationToHeader,
@@ -487,11 +487,11 @@ describe('Jobs Store Utils', () => {
});
});
- describe('updateIncrementalTrace', () => {
+ describe('updateIncrementalJobLog', () => {
describe('without repeated section', () => {
it('concats and parses both arrays', () => {
const oldLog = logLinesParserLegacy(originalTrace);
- const result = updateIncrementalTrace(regularIncremental, oldLog);
+ const result = updateIncrementalJobLog(regularIncremental, oldLog);
expect(result).toEqual([
{
@@ -519,7 +519,7 @@ describe('Jobs Store Utils', () => {
describe('with regular line repeated offset', () => {
it('updates the last line and formats with the incremental part', () => {
const oldLog = logLinesParserLegacy(originalTrace);
- const result = updateIncrementalTrace(regularIncrementalRepeated, oldLog);
+ const result = updateIncrementalJobLog(regularIncrementalRepeated, oldLog);
expect(result).toEqual([
{
@@ -538,7 +538,7 @@ describe('Jobs Store Utils', () => {
describe('with header line repeated', () => {
it('updates the header line and formats with the incremental part', () => {
const oldLog = logLinesParserLegacy(headerTrace);
- const result = updateIncrementalTrace(headerTraceIncremental, oldLog);
+ const result = updateIncrementalJobLog(headerTraceIncremental, oldLog);
expect(result).toEqual([
{
@@ -564,7 +564,7 @@ describe('Jobs Store Utils', () => {
describe('with collapsible line repeated', () => {
it('updates the collapsible line and formats with the incremental part', () => {
const oldLog = logLinesParserLegacy(collapsibleTrace);
- const result = updateIncrementalTrace(collapsibleTraceIncremental, oldLog);
+ const result = updateIncrementalJobLog(collapsibleTraceIncremental, oldLog);
expect(result).toEqual([
{