Открыть боковую панель
nt_test121
nt_project_o05vkt1w9peb
Коммиты
8fee1f2e
Коммит
8fee1f2e
создал
Авг 21, 2019
по автору
Jose Vargas
Просмотр файлов
Fix time_series component specs
владелец
a2335c8e
Изменения
3
Скрыть пробелы
Построчно
Рядом
app/assets/javascripts/monitoring/components/dashboard.vue
Просмотр файла @
8fee1f2e
...
...
@@ -423,6 +423,8 @@ export default {
:clipboard-text=
"generateLink(groupData.group, graphData.title, graphData.y_label)"
:graph-data=
"graphData"
:dashboard-width=
"elWidth"
:alerts-endpoint=
"alertsEndpoint"
:prometheus-alerts-available=
"prometheusAlertsAvailable"
:index=
"`${index}-${graphIndex}`"
/>
</graph-group>
...
...
spec/javascripts/monitoring/charts/time_series_spec.js
Просмотр файла @
8fee1f2e
...
...
@@ -6,7 +6,12 @@ import { shallowWrapperContainsSlotText } from 'spec/helpers/vue_test_utils_help
import
TimeSeries
from
'
~/monitoring/components/charts/time_series.vue
'
;
import
*
as
types
from
'
~/monitoring/stores/mutation_types
'
;
import
{
TEST_HOST
}
from
'
spec/test_constants
'
;
import
MonitoringMock
,
{
deploymentData
,
mockProjectPath
}
from
'
../mock_data
'
;
import
{
deploymentData
,
metricsGroupsAPIResponse
,
mockedQueryResultPayload
,
mockProjectPath
,
}
from
'
../mock_data
'
;
describe
(
'
Time series component
'
,
()
=>
{
const
mockSha
=
'
mockSha
'
;
...
...
@@ -21,9 +26,16 @@ describe('Time series component', () => {
beforeEach
(()
=>
{
store
=
createStore
();
store
.
commit
(
`monitoringDashboard/
${
types
.
RECEIVE_METRICS_DATA_SUCCESS
}
`
,
MonitoringMock
.
data
);
store
.
commit
(
`monitoringDashboard/
${
types
.
RECEIVE_METRICS_DATA_SUCCESS
}
`
,
metricsGroupsAPIResponse
,
);
store
.
commit
(
`monitoringDashboard/
${
types
.
RECEIVE_DEPLOYMENTS_DATA_SUCCESS
}
`
,
deploymentData
);
store
.
dispatch
(
'
monitoringDashboard/setFeatureFlags
'
,
{
exportMetricsToCsvEnabled
:
true
});
store
.
commit
(
`monitoringDashboard/
${
types
.
SET_QUERY_RESULT
}
`
,
{
metricId
:
mockedQueryResultPayload
.
metricId
,
result
:
mockedQueryResultPayload
.
result
,
});
[
mockGraphData
]
=
store
.
state
.
monitoringDashboard
.
groups
[
0
].
metrics
;
makeTimeSeriesChart
=
(
graphData
,
type
)
=>
...
...
@@ -97,11 +109,11 @@ describe('Time series component', () => {
});
it
(
'
formats tooltip title
'
,
()
=>
{
expect
(
timeSeriesChart
.
vm
.
tooltip
.
title
).
toBe
(
'
31 May
201
7
,
9:23P
M
'
);
expect
(
timeSeriesChart
.
vm
.
tooltip
.
title
).
toBe
(
'
16 Jul
201
9
,
10:14A
M
'
);
});
it
(
'
formats tooltip content
'
,
()
=>
{
const
name
=
'
Core Us
age
'
;
const
name
=
'
Pod aver
age
'
;
const
value
=
'
5.556
'
;
const
seriesLabel
=
timeSeriesChart
.
find
(
GlChartSeriesLabel
);
...
...
@@ -124,7 +136,7 @@ describe('Time series component', () => {
});
it
(
'
formats tooltip title
'
,
()
=>
{
expect
(
timeSeriesChart
.
vm
.
tooltip
.
title
).
toBe
(
'
31 May
201
7
,
9:23P
M
'
);
expect
(
timeSeriesChart
.
vm
.
tooltip
.
title
).
toBe
(
'
16 Jul
201
9
,
10:14A
M
'
);
});
it
(
'
formats tooltip sha
'
,
()
=>
{
...
...
@@ -220,9 +232,9 @@ describe('Time series component', () => {
describe
(
'
scatterSeries
'
,
()
=>
{
it
(
'
utilizes deployment data
'
,
()
=>
{
expect
(
timeSeriesChart
.
vm
.
scatterSeries
.
data
).
toEqual
([
[
'
201
7
-0
5-31T21:23:37.881
Z
'
,
0
],
[
'
201
7
-0
5-30T20:08:04.62
9Z
'
,
0
],
[
'
201
7
-0
5-30T17:42:38.40
9Z
'
,
0
],
[
'
201
9
-0
7-16T10:14:25.589
Z
'
,
0
],
[
'
201
9
-0
7-16T11:14:25.58
9Z
'
,
0
],
[
'
201
9
-0
7-16T12:14:25.58
9Z
'
,
0
],
]);
expect
(
timeSeriesChart
.
vm
.
scatterSeries
.
symbolSize
).
toBe
(
14
);
...
...
@@ -231,7 +243,7 @@ describe('Time series component', () => {
describe
(
'
yAxisLabel
'
,
()
=>
{
it
(
'
constructs a label for the chart y-axis
'
,
()
=>
{
expect
(
timeSeriesChart
.
vm
.
yAxisLabel
).
toBe
(
'
CPU
'
);
expect
(
timeSeriesChart
.
vm
.
yAxisLabel
).
toBe
(
'
Memory Used per Pod
'
);
});
});
...
...
spec/javascripts/monitoring/mock_data.js
Просмотр файла @
8fee1f2e
export
const
mockApiEndpoint
=
`
${
gl
.
TEST_HOST
}
/monitoring/mock`
;
export
const
mockProjectPath
=
'
/frontend-fixtures/environments-project
'
;
export
const
metricsGroupsAPIResponse
=
[
{
group
:
'
System metrics (Kubernetes)
'
,
...
...
@@ -297,7 +299,7 @@ export const graphDataPrometheusQueryRange = {
],
queries
:
[
{
metricId
:
null
,
metricId
:
'
10
'
,
id
:
'
metric_a1
'
,
metric_id
:
2
,
query_range
:
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать