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
35b2cd44
Commit
35b2cd44
authored
Mar 30, 2020
by
Ryan Cobb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs around metric defined step
parent
9d727b32
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
0 deletions
+80
-0
spec/frontend/monitoring/store/actions_spec.js
spec/frontend/monitoring/store/actions_spec.js
+80
-0
No files found.
spec/frontend/monitoring/store/actions_spec.js
View file @
35b2cd44
...
...
@@ -557,6 +557,86 @@ describe('Monitoring store actions', () => {
).
catch
(
done
.
fail
);
});
describe
(
'
without metric defined step
'
,
()
=>
{
const
expectedParams
=
{
start_time
:
'
2019-08-06T12:40:02.184Z
'
,
end_time
:
'
2019-08-06T20:40:02.184Z
'
,
step
:
60
};
it
(
'
uses calculated step
'
,
done
=>
{
mock
.
onGet
(
'
http://test
'
).
reply
(
200
,
{
data
});
// One attempt
testAction
(
fetchPrometheusMetric
,
{
metric
,
params
},
state
,
[
{
type
:
types
.
REQUEST_METRIC_RESULT
,
payload
:
{
metricId
:
metric
.
metricId
,
},
},
{
type
:
types
.
RECEIVE_METRIC_RESULT_SUCCESS
,
payload
:
{
metricId
:
metric
.
metricId
,
result
:
data
.
result
,
},
},
],
[],
()
=>
{
expect
(
mock
.
history
.
get
[
0
].
params
).
toEqual
(
expectedParams
);
done
();
},
).
catch
(
done
.
fail
);
});
});
describe
(
'
with metric defined step
'
,
()
=>
{
beforeEach
(()
=>
{
metric
.
step
=
10
;
});
const
expectedParams
=
{
start_time
:
'
2019-08-06T12:40:02.184Z
'
,
end_time
:
'
2019-08-06T20:40:02.184Z
'
,
step
:
10
};
it
(
'
uses metric step
'
,
done
=>
{
mock
.
onGet
(
'
http://test
'
).
reply
(
200
,
{
data
});
// One attempt
testAction
(
fetchPrometheusMetric
,
{
metric
,
params
},
state
,
[
{
type
:
types
.
REQUEST_METRIC_RESULT
,
payload
:
{
metricId
:
metric
.
metricId
,
},
},
{
type
:
types
.
RECEIVE_METRIC_RESULT_SUCCESS
,
payload
:
{
metricId
:
metric
.
metricId
,
result
:
data
.
result
,
},
},
],
[],
()
=>
{
expect
(
mock
.
history
.
get
[
0
].
params
).
toEqual
(
expectedParams
);
done
();
},
).
catch
(
done
.
fail
);
});
});
it
(
'
commits result, when waiting for results
'
,
done
=>
{
// Mock multiple attempts while the cache is filling up
mock
.
onGet
(
'
http://test
'
).
replyOnce
(
statusCodes
.
NO_CONTENT
);
...
...
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