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
bfcaba70
Commit
bfcaba70
authored
Mar 06, 2020
by
Jose Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change specs to reflect the new dashboard order
parent
7c2b7f70
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
15 deletions
+19
-15
spec/frontend/monitoring/components/charts/time_series_spec.js
...frontend/monitoring/components/charts/time_series_spec.js
+1
-1
spec/frontend/monitoring/store/getters_spec.js
spec/frontend/monitoring/store/getters_spec.js
+8
-8
spec/frontend/monitoring/store/mutations_spec.js
spec/frontend/monitoring/store/mutations_spec.js
+10
-6
No files found.
spec/frontend/monitoring/components/charts/time_series_spec.js
View file @
bfcaba70
...
...
@@ -69,7 +69,7 @@ describe('Time series component', () => {
mockedQueryResultFixture
,
);
// dashboard is a dynamically generated fixture and stored at environment_metrics_dashboard.json
[
mockGraphData
]
=
store
.
state
.
monitoringDashboard
.
dashboard
.
panelGroups
[
0
].
panels
;
[
mockGraphData
]
=
store
.
state
.
monitoringDashboard
.
dashboard
.
panelGroups
[
1
].
panels
;
});
describe
(
'
general functions
'
,
()
=>
{
...
...
spec/frontend/monitoring/store/getters_spec.js
View file @
bfcaba70
...
...
@@ -89,8 +89,8 @@ describe('Monitoring store Getters', () => {
expect
(
getMetricStates
()).
toEqual
([
metricStates
.
OK
]);
// Filtered by groups
expect
(
getMetricStates
(
state
.
dashboard
.
panelGroups
[
0
].
key
)).
toEqual
([
metricStates
.
OK
]);
expect
(
getMetricStates
(
state
.
dashboard
.
panelGroups
[
1
].
key
)).
toEqual
([]);
expect
(
getMetricStates
(
state
.
dashboard
.
panelGroups
[
1
].
key
)).
toEqual
([
metricStates
.
OK
]);
expect
(
getMetricStates
(
state
.
dashboard
.
panelGroups
[
2
].
key
)).
toEqual
([]);
});
it
(
'
on multiple metrics errors
'
,
()
=>
{
mutations
[
types
.
RECEIVE_METRICS_DATA_SUCCESS
](
state
,
metricsDashboardPayload
);
...
...
@@ -118,18 +118,18 @@ describe('Monitoring store Getters', () => {
mutations
[
types
.
RECEIVE_METRIC_RESULT_SUCCESS
](
state
,
mockedQueryResultFixture
);
// An error in 2 groups
mutations
[
types
.
RECEIVE_METRIC_RESULT_FAILURE
](
state
,
{
metricId
:
groups
[
0
].
panels
[
1
].
metrics
[
0
].
metricId
,
metricId
:
groups
[
1
].
panels
[
1
].
metrics
[
0
].
metricId
,
});
mutations
[
types
.
RECEIVE_METRIC_RESULT_FAILURE
](
state
,
{
metricId
:
groups
[
1
].
panels
[
0
].
metrics
[
0
].
metricId
,
metricId
:
groups
[
2
].
panels
[
0
].
metrics
[
0
].
metricId
,
});
expect
(
getMetricStates
()).
toEqual
([
metricStates
.
OK
,
metricStates
.
UNKNOWN_ERROR
]);
expect
(
getMetricStates
(
groups
[
0
].
key
)).
toEqual
([
expect
(
getMetricStates
(
groups
[
1
].
key
)).
toEqual
([
metricStates
.
OK
,
metricStates
.
UNKNOWN_ERROR
,
]);
expect
(
getMetricStates
(
groups
[
1
].
key
)).
toEqual
([
metricStates
.
UNKNOWN_ERROR
]);
expect
(
getMetricStates
(
groups
[
2
].
key
)).
toEqual
([
metricStates
.
UNKNOWN_ERROR
]);
});
});
});
...
...
@@ -210,13 +210,13 @@ describe('Monitoring store Getters', () => {
mutations
[
types
.
RECEIVE_METRIC_RESULT_SUCCESS
](
state
,
mockedQueryResultFixtureStatusCode
);
// First group has metrics
expect
(
metricsWithData
(
state
.
dashboard
.
panelGroups
[
0
].
key
)).
toEqual
([
expect
(
metricsWithData
(
state
.
dashboard
.
panelGroups
[
1
].
key
)).
toEqual
([
mockedQueryResultFixture
.
metricId
,
mockedQueryResultFixtureStatusCode
.
metricId
,
]);
// Second group has no metrics
expect
(
metricsWithData
(
state
.
dashboard
.
panelGroups
[
1
].
key
)).
toEqual
([]);
expect
(
metricsWithData
(
state
.
dashboard
.
panelGroups
[
2
].
key
)).
toEqual
([]);
});
});
});
...
...
spec/frontend/monitoring/store/mutations_spec.js
View file @
bfcaba70
...
...
@@ -32,12 +32,13 @@ describe('Monitoring mutations', () => {
mutations
[
types
.
RECEIVE_METRICS_DATA_SUCCESS
](
stateCopy
,
payload
);
const
groups
=
getGroups
();
expect
(
groups
[
0
].
key
).
toBe
(
'
response-metrics-nginx-ingress-vts-0
'
);
expect
(
groups
[
1
].
key
).
toBe
(
'
response-metrics-nginx-ingress-1
'
);
expect
(
groups
[
0
].
key
).
toBe
(
'
system-metrics-kubernetes-0
'
);
expect
(
groups
[
1
].
key
).
toBe
(
'
response-metrics-nginx-ingress-vts-1
'
);
expect
(
groups
[
2
].
key
).
toBe
(
'
response-metrics-nginx-ingress-2
'
);
});
it
(
'
normalizes values
'
,
()
=>
{
mutations
[
types
.
RECEIVE_METRICS_DATA_SUCCESS
](
stateCopy
,
payload
);
const
expectedLabel
=
'
5xx Errors (%
)
'
;
const
expectedLabel
=
'
Pod average (MB
)
'
;
const
{
label
,
queryRange
}
=
getGroups
()[
0
].
panels
[
2
].
metrics
[
0
];
expect
(
label
).
toEqual
(
expectedLabel
);
...
...
@@ -51,7 +52,7 @@ describe('Monitoring mutations', () => {
expect
(
groups
).
toBeDefined
();
expect
(
groups
).
toHaveLength
(
6
);
expect
(
groups
[
0
].
panels
).
toHaveLength
(
3
);
expect
(
groups
[
0
].
panels
).
toHaveLength
(
7
);
expect
(
groups
[
0
].
panels
[
0
].
metrics
).
toHaveLength
(
1
);
expect
(
groups
[
0
].
panels
[
1
].
metrics
).
toHaveLength
(
1
);
expect
(
groups
[
0
].
panels
[
2
].
metrics
).
toHaveLength
(
1
);
...
...
@@ -65,9 +66,12 @@ describe('Monitoring mutations', () => {
const
groups
=
getGroups
();
expect
(
groups
[
0
].
panels
[
0
].
metrics
[
0
].
metricId
).
toEqual
(
'
undefined_
response_metrics_nginx_ingress_throughput_status_code
'
,
'
undefined_
system_metrics_kubernetes_container_memory_total
'
,
);
expect
(
groups
[
1
].
panels
[
0
].
metrics
[
0
].
metricId
).
toEqual
(
'
undefined_response_metrics_nginx_ingress_throughput_status_code
'
,
);
expect
(
groups
[
2
].
panels
[
0
].
metrics
[
0
].
metricId
).
toEqual
(
'
undefined_response_metrics_nginx_ingress_16_throughput_status_code
'
,
);
});
...
...
@@ -135,7 +139,7 @@ describe('Monitoring mutations', () => {
},
];
const
dashboard
=
metricsDashboardPayload
;
const
getMetric
=
()
=>
stateCopy
.
dashboard
.
panelGroups
[
0
].
panels
[
0
].
metrics
[
0
];
const
getMetric
=
()
=>
stateCopy
.
dashboard
.
panelGroups
[
1
].
panels
[
0
].
metrics
[
0
];
describe
(
'
REQUEST_METRIC_RESULT
'
,
()
=>
{
beforeEach
(()
=>
{
...
...
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