summaryrefslogtreecommitdiff
path: root/spec/frontend/logs
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-08 09:09:43 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-08 09:09:43 +0000
commitf5050253469fc0961c02deec0e698ad62bdd9de5 (patch)
tree30bbd8f8b556fd5b730f0123921138ee1d6bdaa2 /spec/frontend/logs
parentf6cdec670b9b757fc2225a2c6627ab79765e5b8a (diff)
downloadgitlab-ce-f5050253469fc0961c02deec0e698ad62bdd9de5.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/logs')
-rw-r--r--spec/frontend/logs/components/environment_logs_spec.js15
-rw-r--r--spec/frontend/logs/stores/actions_spec.js37
-rw-r--r--spec/frontend/logs/stores/mutations_spec.js9
3 files changed, 37 insertions, 24 deletions
diff --git a/spec/frontend/logs/components/environment_logs_spec.js b/spec/frontend/logs/components/environment_logs_spec.js
index 4da987725a1..befcd462828 100644
--- a/spec/frontend/logs/components/environment_logs_spec.js
+++ b/spec/frontend/logs/components/environment_logs_spec.js
@@ -47,7 +47,7 @@ describe('EnvironmentLogs', () => {
const findLogControlButtons = () => wrapper.find({ name: 'log-control-buttons-stub' });
const findInfiniteScroll = () => wrapper.find({ ref: 'infiniteScroll' });
- const findLogTrace = () => wrapper.find('.js-log-trace');
+ const findLogTrace = () => wrapper.find({ ref: 'logTrace' });
const findLogFooter = () => wrapper.find({ ref: 'logFooter' });
const getInfiniteScrollAttr = attr => parseInt(findInfiniteScroll().attributes(attr), 10);
@@ -169,16 +169,12 @@ describe('EnvironmentLogs', () => {
expect(updateControlBtnsMock).not.toHaveBeenCalled();
});
- it('shows an infinite scroll with height and no content', () => {
- expect(getInfiniteScrollAttr('max-list-height')).toBeGreaterThan(0);
+ it('shows an infinite scroll with no content', () => {
expect(getInfiniteScrollAttr('fetched-items')).toBe(0);
});
- it('shows an infinite scroll container with equal height and max-height ', () => {
- const height = getInfiniteScrollAttr('max-list-height');
-
- expect(height).toEqual(expect.any(Number));
- expect(findInfiniteScroll().attributes('style')).toMatch(`height: ${height}px;`);
+ it('shows an infinite scroll container with no set max-height ', () => {
+ expect(findInfiniteScroll().attributes('max-list-height')).toBeUndefined();
});
it('shows a logs trace', () => {
@@ -270,8 +266,7 @@ describe('EnvironmentLogs', () => {
expect(findAdvancedFilters().exists()).toBe(true);
});
- it('shows infinite scroll with height and no content', () => {
- expect(getInfiniteScrollAttr('max-list-height')).toBeGreaterThan(0);
+ it('shows infinite scroll with content', () => {
expect(getInfiniteScrollAttr('fetched-items')).toBe(mockTrace.length);
});
diff --git a/spec/frontend/logs/stores/actions_spec.js b/spec/frontend/logs/stores/actions_spec.js
index 303737a11cd..882673af984 100644
--- a/spec/frontend/logs/stores/actions_spec.js
+++ b/spec/frontend/logs/stores/actions_spec.js
@@ -38,7 +38,7 @@ jest.mock('~/logs/utils');
const mockDefaultRange = {
start: '2020-01-10T18:00:00.000Z',
- end: '2020-01-10T10:00:00.000Z',
+ end: '2020-01-10T19:00:00.000Z',
};
const mockFixedRange = {
start: '2020-01-09T18:06:20.000Z',
@@ -145,9 +145,6 @@ describe('Logs Store actions', () => {
{ type: types.RECEIVE_ENVIRONMENTS_DATA_ERROR },
],
[],
- () => {
- expect(flash).toHaveBeenCalledTimes(1);
- },
);
});
});
@@ -186,6 +183,7 @@ describe('Logs Store actions', () => {
it('should commit logs and pod data when there is pod name defined', () => {
state.pods.current = mockPodName;
+ state.timeRange.current = mockFixedRange;
return testAction(fetchLogs, null, state, expectedMutations, expectedActions, () => {
expect(latestGetParams()).toMatchObject({
@@ -214,22 +212,26 @@ describe('Logs Store actions', () => {
state.search = mockSearch;
state.timeRange.current = 'INVALID_TIME_RANGE';
+ expectedMutations.splice(1, 0, {
+ type: types.SHOW_TIME_RANGE_INVALID_WARNING,
+ });
+
return testAction(fetchLogs, null, state, expectedMutations, expectedActions, () => {
expect(latestGetParams()).toEqual({
pod_name: mockPodName,
search: mockSearch,
});
- // Warning about time ranges was issued
- expect(flash).toHaveBeenCalledTimes(1);
- expect(flash).toHaveBeenCalledWith(expect.any(String), 'warning');
});
});
it('should commit logs and pod data when no pod name defined', () => {
- state.timeRange.current = mockDefaultRange;
+ state.timeRange.current = defaultTimeRange;
return testAction(fetchLogs, null, state, expectedMutations, expectedActions, () => {
- expect(latestGetParams()).toEqual({});
+ expect(latestGetParams()).toEqual({
+ start_time: expect.any(String),
+ end_time: expect.any(String),
+ });
});
});
});
@@ -249,6 +251,7 @@ describe('Logs Store actions', () => {
it('should commit logs and pod data when there is pod name defined', () => {
state.pods.current = mockPodName;
+ state.timeRange.current = mockFixedRange;
expectedActions = [];
@@ -293,6 +296,10 @@ describe('Logs Store actions', () => {
state.search = mockSearch;
state.timeRange.current = 'INVALID_TIME_RANGE';
+ expectedMutations.splice(1, 0, {
+ type: types.SHOW_TIME_RANGE_INVALID_WARNING,
+ });
+
return testAction(
fetchMoreLogsPrepend,
null,
@@ -304,15 +311,12 @@ describe('Logs Store actions', () => {
pod_name: mockPodName,
search: mockSearch,
});
- // Warning about time ranges was issued
- expect(flash).toHaveBeenCalledTimes(1);
- expect(flash).toHaveBeenCalledWith(expect.any(String), 'warning');
},
);
});
it('should commit logs and pod data when no pod name defined', () => {
- state.timeRange.current = mockDefaultRange;
+ state.timeRange.current = defaultTimeRange;
return testAction(
fetchMoreLogsPrepend,
@@ -321,7 +325,10 @@ describe('Logs Store actions', () => {
expectedMutations,
expectedActions,
() => {
- expect(latestGetParams()).toEqual({});
+ expect(latestGetParams()).toEqual({
+ start_time: expect.any(String),
+ end_time: expect.any(String),
+ });
},
);
});
@@ -357,6 +364,7 @@ describe('Logs Store actions', () => {
it('fetchLogs should commit logs and pod errors', () => {
state.environments.options = mockEnvironments;
state.environments.current = mockEnvName;
+ state.timeRange.current = defaultTimeRange;
return testAction(
fetchLogs,
@@ -377,6 +385,7 @@ describe('Logs Store actions', () => {
it('fetchMoreLogsPrepend should commit logs and pod errors', () => {
state.environments.options = mockEnvironments;
state.environments.current = mockEnvName;
+ state.timeRange.current = defaultTimeRange;
return testAction(
fetchMoreLogsPrepend,
diff --git a/spec/frontend/logs/stores/mutations_spec.js b/spec/frontend/logs/stores/mutations_spec.js
index 37db355af09..46561055a4a 100644
--- a/spec/frontend/logs/stores/mutations_spec.js
+++ b/spec/frontend/logs/stores/mutations_spec.js
@@ -67,6 +67,7 @@ describe('Logs Store Mutations', () => {
options: [],
isLoading: false,
current: null,
+ fetchError: true,
});
});
});
@@ -83,6 +84,7 @@ describe('Logs Store Mutations', () => {
expect(state.logs).toEqual({
lines: [],
cursor: null,
+ fetchError: false,
isLoading: true,
isComplete: false,
});
@@ -101,6 +103,7 @@ describe('Logs Store Mutations', () => {
isLoading: false,
cursor: mockCursor,
isComplete: false,
+ fetchError: false,
});
});
@@ -115,6 +118,7 @@ describe('Logs Store Mutations', () => {
isLoading: false,
cursor: null,
isComplete: true,
+ fetchError: false,
});
});
});
@@ -128,6 +132,7 @@ describe('Logs Store Mutations', () => {
isLoading: false,
cursor: null,
isComplete: false,
+ fetchError: true,
});
});
});
@@ -152,6 +157,7 @@ describe('Logs Store Mutations', () => {
isLoading: false,
cursor: mockCursor,
isComplete: false,
+ fetchError: false,
});
});
@@ -171,6 +177,7 @@ describe('Logs Store Mutations', () => {
isLoading: false,
cursor: mockNextCursor,
isComplete: false,
+ fetchError: false,
});
});
@@ -185,6 +192,7 @@ describe('Logs Store Mutations', () => {
isLoading: false,
cursor: null,
isComplete: true,
+ fetchError: false,
});
});
});
@@ -194,6 +202,7 @@ describe('Logs Store Mutations', () => {
mutations[types.RECEIVE_LOGS_DATA_PREPEND_ERROR](state);
expect(state.logs.isLoading).toBe(false);
+ expect(state.logs.fetchError).toBe(true);
});
});