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
5b2ba400
Commit
5b2ba400
authored
May 07, 2021
by
Frédéric Caplette
Committed by
Scott Hampton
May 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix flaky jest spec in links_layer_spec.js
parent
967a403c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
app/assets/javascripts/pipelines/components/graph_shared/api.js
...sets/javascripts/pipelines/components/graph_shared/api.js
+5
-0
spec/frontend/pipelines/graph_shared/links_layer_spec.js
spec/frontend/pipelines/graph_shared/links_layer_spec.js
+8
-6
No files found.
app/assets/javascripts/pipelines/components/graph_shared/api.js
View file @
5b2ba400
...
...
@@ -2,6 +2,11 @@ import axios from '~/lib/utils/axios_utils';
import
{
reportToSentry
}
from
'
../../utils
'
;
export
const
reportPerformance
=
(
path
,
stats
)
=>
{
// FIXME: https://gitlab.com/gitlab-org/gitlab/-/issues/330245
if
(
!
path
)
{
return
;
}
axios
.
post
(
path
,
stats
).
catch
((
err
)
=>
{
reportToSentry
(
'
links_inner_perf
'
,
`error:
${
err
}
`
);
});
...
...
spec/frontend/pipelines/graph_shared/links_layer_spec.js
View file @
5b2ba400
...
...
@@ -96,23 +96,19 @@ describe('links layer component', () => {
});
describe
(
'
performance metrics
'
,
()
=>
{
const
metricsPath
=
'
/root/project/-/ci/prometheus_metrics/histograms.json
'
;
let
markAndMeasure
;
let
reportToSentry
;
let
reportPerformance
;
let
mock
;
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
jest
.
spyOn
(
window
,
'
requestAnimationFrame
'
).
mockImplementation
((
cb
)
=>
cb
());
markAndMeasure
=
jest
.
spyOn
(
perfUtils
,
'
performanceMarkAndMeasure
'
);
reportToSentry
=
jest
.
spyOn
(
sentryUtils
,
'
reportToSentry
'
);
reportPerformance
=
jest
.
spyOn
(
Api
,
'
reportPerformance
'
);
});
afterEach
(()
=>
{
mock
.
restore
();
});
describe
(
'
with no metrics config object
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
();
...
...
@@ -164,7 +160,6 @@ describe('links layer component', () => {
});
describe
(
'
with metrics path and collect set to true
'
,
()
=>
{
const
metricsPath
=
'
/root/project/-/ci/prometheus_metrics/histograms.json
'
;
const
duration
=
875
;
const
numLinks
=
7
;
const
totalGroups
=
8
;
...
...
@@ -204,6 +199,9 @@ describe('links layer component', () => {
describe
(
'
with duration and no error
'
,
()
=>
{
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
.
onPost
(
metricsPath
).
reply
(
200
,
{});
jest
.
spyOn
(
window
.
performance
,
'
getEntriesByName
'
).
mockImplementation
(()
=>
{
return
[{
duration
}];
});
...
...
@@ -218,6 +216,10 @@ describe('links layer component', () => {
});
});
afterEach
(()
=>
{
mock
.
restore
();
});
it
(
'
it calls reportPerformance with expected arguments
'
,
()
=>
{
expect
(
markAndMeasure
).
toHaveBeenCalled
();
expect
(
reportPerformance
).
toHaveBeenCalled
();
...
...
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