Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
67b3a450
Commit
67b3a450
authored
Jan 23, 2020
by
Tristan Read
Committed by
Kushal Pandya
Jan 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that error tracking frontend only polls when required
parent
fcda99fa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
10 deletions
+40
-10
app/assets/javascripts/error_tracking/store/details/actions.js
...ssets/javascripts/error_tracking/store/details/actions.js
+0
-2
changelogs/unreleased/tr-fix-frontend-polling.yml
changelogs/unreleased/tr-fix-frontend-polling.yml
+5
-0
spec/frontend/error_tracking/store/details/actions_spec.js
spec/frontend/error_tracking/store/details/actions_spec.js
+35
-8
No files found.
app/assets/javascripts/error_tracking/store/details/actions.js
View file @
67b3a450
...
...
@@ -18,7 +18,6 @@ export function startPollingDetails({ commit }, endpoint) {
data
:
{
endpoint
},
successCallback
:
({
data
})
=>
{
if
(
!
data
)
{
detailPoll
.
restart
();
return
;
}
...
...
@@ -43,7 +42,6 @@ export function startPollingStacktrace({ commit }, endpoint) {
data
:
{
endpoint
},
successCallback
:
({
data
})
=>
{
if
(
!
data
)
{
stackTracePoll
.
restart
();
return
;
}
commit
(
types
.
SET_STACKTRACE_DATA
,
data
.
error
);
...
...
changelogs/unreleased/tr-fix-frontend-polling.yml
0 → 100644
View file @
67b3a450
---
title
:
Ensure that error tracking frontend only polls when required
merge_request
:
23305
author
:
type
:
fixed
spec/frontend/error_tracking/store/details/actions_spec.js
View file @
67b3a450
...
...
@@ -4,27 +4,33 @@ import axios from '~/lib/utils/axios_utils';
import
createFlash
from
'
~/flash
'
;
import
*
as
actions
from
'
~/error_tracking/store/details/actions
'
;
import
*
as
types
from
'
~/error_tracking/store/details/mutation_types
'
;
import
Poll
from
'
~/lib/utils/poll
'
;
let
mockedAdapter
;
let
mockedRestart
;
jest
.
mock
(
'
~/flash.js
'
);
jest
.
mock
(
'
~/lib/utils/url_utility
'
);
let
mock
;
describe
(
'
Sentry error details store actions
'
,
()
=>
{
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
edAdapter
=
new
MockAdapter
(
axios
);
});
afterEach
(()
=>
{
mock
.
restore
();
mock
edAdapter
.
restore
();
createFlash
.
mockClear
();
if
(
mockedRestart
)
{
mockedRestart
.
mockRestore
();
mockedRestart
=
null
;
}
});
describe
(
'
startPollingDetails
'
,
()
=>
{
const
endpoint
=
'
123/details
'
;
it
(
'
should commit SET_ERROR with received response
'
,
done
=>
{
const
payload
=
{
error
:
{
id
:
1
}
};
mock
.
onGet
().
reply
(
200
,
payload
);
mock
edAdapter
.
onGet
().
reply
(
200
,
payload
);
testAction
(
actions
.
startPollingDetails
,
{
endpoint
},
...
...
@@ -41,7 +47,7 @@ describe('Sentry error details store actions', () => {
});
it
(
'
should show flash on API error
'
,
done
=>
{
mock
.
onGet
().
reply
(
400
);
mock
edAdapter
.
onGet
().
reply
(
400
);
testAction
(
actions
.
startPollingDetails
,
...
...
@@ -55,13 +61,23 @@ describe('Sentry error details store actions', () => {
},
);
});
it
(
'
should not restart polling when receiving an empty 204 response
'
,
done
=>
{
mockedRestart
=
jest
.
spyOn
(
Poll
.
prototype
,
'
restart
'
);
mockedAdapter
.
onGet
().
reply
(
204
);
testAction
(
actions
.
startPollingDetails
,
{
endpoint
},
{},
[],
[],
()
=>
{
expect
(
mockedRestart
).
toHaveBeenCalledTimes
(
0
);
done
();
});
});
});
describe
(
'
startPollingStacktrace
'
,
()
=>
{
const
endpoint
=
'
123/stacktrace
'
;
it
(
'
should commit SET_ERROR with received response
'
,
done
=>
{
const
payload
=
{
error
:
[
1
,
2
,
3
]
};
mock
.
onGet
().
reply
(
200
,
payload
);
mock
edAdapter
.
onGet
().
reply
(
200
,
payload
);
testAction
(
actions
.
startPollingStacktrace
,
{
endpoint
},
...
...
@@ -78,7 +94,7 @@ describe('Sentry error details store actions', () => {
});
it
(
'
should show flash on API error
'
,
done
=>
{
mock
.
onGet
().
reply
(
400
);
mock
edAdapter
.
onGet
().
reply
(
400
);
testAction
(
actions
.
startPollingStacktrace
,
...
...
@@ -92,5 +108,16 @@ describe('Sentry error details store actions', () => {
},
);
});
it
(
'
should not restart polling when receiving an empty 204 response
'
,
done
=>
{
mockedRestart
=
jest
.
spyOn
(
Poll
.
prototype
,
'
restart
'
);
mockedAdapter
.
onGet
().
reply
(
204
);
testAction
(
actions
.
startPollingStacktrace
,
{
endpoint
},
{},
[],
[],
()
=>
{
mockedRestart
=
jest
.
spyOn
(
Poll
.
prototype
,
'
restart
'
);
expect
(
mockedRestart
).
toHaveBeenCalledTimes
(
0
);
done
();
});
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment