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
7ab55880
Commit
7ab55880
authored
May 08, 2020
by
Sofia Vistas
Committed by
Dan Davison
May 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add e2e test for incidents management
Add runner to the test Fix test structure and logic
parent
e47f8abd
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
274 additions
and
131 deletions
+274
-131
app/assets/javascripts/monitoring/components/dashboard_panel.vue
...ets/javascripts/monitoring/components/dashboard_panel.vue
+1
-0
app/views/layouts/nav/sidebar/_project.html.haml
app/views/layouts/nav/sidebar/_project.html.haml
+2
-2
app/views/projects/settings/operations/_incidents.html.haml
app/views/projects/settings/operations/_incidents.html.haml
+4
-4
qa/qa.rb
qa/qa.rb
+2
-0
qa/qa/fixtures/monitored_auto_devops/.gitlab-ci.yml
qa/qa/fixtures/monitored_auto_devops/.gitlab-ci.yml
+3
-2
qa/qa/page/project/operations/kubernetes/index.rb
qa/qa/page/project/operations/kubernetes/index.rb
+4
-0
qa/qa/page/project/operations/metrics/show.rb
qa/qa/page/project/operations/metrics/show.rb
+6
-0
qa/qa/page/project/settings/incidents.rb
qa/qa/page/project/settings/incidents.rb
+37
-0
qa/qa/page/project/settings/operations.rb
qa/qa/page/project/settings/operations.rb
+23
-0
qa/qa/page/project/sub_menus/operations.rb
qa/qa/page/project/sub_menus/operations.rb
+3
-3
qa/qa/page/project/sub_menus/settings.rb
qa/qa/page/project/sub_menus/settings.rb
+9
-0
qa/qa/specs/features/ee/browser_ui/8_monitor/.gitkeep
qa/qa/specs/features/ee/browser_ui/8_monitor/.gitkeep
+0
-0
qa/qa/specs/features/ee/browser_ui/8_monitor/all_monitor_features_spec.rb
...ures/ee/browser_ui/8_monitor/all_monitor_features_spec.rb
+180
-0
qa/qa/specs/features/ee/browser_ui/8_monitor/apm/metrics_spec.rb
...pecs/features/ee/browser_ui/8_monitor/apm/metrics_spec.rb
+0
-68
qa/qa/specs/features/ee/browser_ui/8_monitor/health/cluster_health_spec.rb
...res/ee/browser_ui/8_monitor/health/cluster_health_spec.rb
+0
-52
No files found.
app/assets/javascripts/monitoring/components/dashboard_panel.vue
View file @
7ab55880
...
...
@@ -345,6 +345,7 @@ export default {
ref=
"copyChartLink"
v-track-event=
"generateLinkToChartOptions(clipboardText)"
:data-clipboard-text=
"clipboardText"
data-qa-selector=
"generate_chart_link_menu_item"
@
click=
"showToast(clipboardText)"
>
{{ __('Copy link to chart') }}
...
...
app/views/layouts/nav/sidebar/_project.html.haml
View file @
7ab55880
...
...
@@ -203,7 +203,7 @@
-
if
project_nav_tab?
:operations
=
nav_link
(
controller:
sidebar_operations_paths
)
do
=
link_to
sidebar_operations_link_path
,
class:
'shortcuts-operations
qa-link-operations'
do
=
link_to
sidebar_operations_link_path
,
class:
'shortcuts-operations
'
,
data:
{
qa_selector:
'operations_link'
}
do
.nav-icon-container
=
sprite_icon
(
'cloud-gear'
)
%span
.nav-item-name
...
...
@@ -375,7 +375,7 @@
=
_
(
'CI / CD'
)
-
if
!
@project
.
archived?
&&
settings_operations_available?
=
nav_link
(
controller:
[
:operations
])
do
=
link_to
project_settings_operations_path
(
@project
),
title:
_
(
'Operations'
)
do
=
link_to
project_settings_operations_path
(
@project
),
title:
_
(
'Operations'
)
,
data:
{
qa_selector:
'operations_settings_link'
}
do
=
_
(
'Operations'
)
-
if
@project
.
pages_available?
=
nav_link
(
controller: :pages
)
do
...
...
app/views/projects/settings/operations/_incidents.html.haml
View file @
7ab55880
...
...
@@ -2,7 +2,7 @@
-
setting
=
project_incident_management_setting
-
templates
=
setting
.
available_issue_templates
.
map
{
|
t
|
[
t
.
name
,
t
.
key
]
}
%section
.settings.no-animate.qa-incident-management-settings
%section
.settings.no-animate.qa-incident-management-settings
{
data:
{
qa_selector:
'incidents_settings_content'
}
}
.settings-header
%h3
{
:class
=>
"h4"
}=
_
(
'Incidents'
)
%button
.btn.js-settings-toggle
{
type:
'button'
}
...
...
@@ -17,16 +17,16 @@
.form-group
=
f
.
fields_for
:incident_management_setting_attributes
,
setting
do
|
form
|
.form-group
=
form
.
check_box
:create_issue
=
form
.
check_box
:create_issue
,
data:
{
qa_selector:
'create_issue_checkbox'
}
=
form
.
label
:create_issue
,
_
(
'Create an issue. Issues are created for each alert triggered.'
),
class:
'form-check-label'
.form-group.col-sm-8
=
form
.
label
:issue_template_key
,
class:
'label-bold'
do
=
_
(
'Issue template (optional)'
)
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'user/project/description_templates'
,
anchor:
'creating-issue-templates'
),
target:
'_blank'
,
rel:
'noopener noreferrer'
.select-wrapper
=
form
.
select
:issue_template_key
,
templates
,
{
include_blank:
'No template selected'
},
class:
"form-control select-control"
=
form
.
select
:issue_template_key
,
templates
,
{
include_blank:
'No template selected'
},
class:
"form-control select-control"
,
data:
{
qa_selector:
'incident_templates_dropdown'
}
=
icon
(
'chevron-down'
)
.form-group
=
form
.
check_box
:send_email
=
form
.
label
:send_email
,
_
(
'Send a separate email notification to Developers.'
),
class:
'form-check-label'
=
f
.
submit
_
(
'Save changes'
),
class:
'btn btn-success'
=
f
.
submit
_
(
'Save changes'
),
class:
'btn btn-success'
,
data:
{
qa_selector:
'save_changes_button'
}
qa/qa.rb
View file @
7ab55880
...
...
@@ -262,6 +262,8 @@ module QA
autoload
:Members
,
'qa/page/project/settings/members'
autoload
:MirroringRepositories
,
'qa/page/project/settings/mirroring_repositories'
autoload
:VisibilityFeaturesPermissions
,
'qa/page/project/settings/visibility_features_permissions'
autoload
:Operations
,
'qa/page/project/settings/operations'
autoload
:Incidents
,
'qa/page/project/settings/incidents'
end
module
SubMenus
...
...
qa/qa/fixtures/monitored_auto_devops/.gitlab-ci.yml
View file @
7ab55880
...
...
@@ -22,10 +22,12 @@ variables:
stages
:
-
production
# This job continuously deploys to
staging/
production on every push to `master`.
# This job continuously deploys to production on every push to `master`.
production
:
stage
:
production
tags
:
-
qa
script
:
-
check_kube_domain
-
install_dependencies
...
...
@@ -34,7 +36,6 @@ production:
-
initialize_tiller
-
create_secret
-
deploy
-
persist_environment_url
environment
:
name
:
production
url
:
http://$CI_PROJECT_PATH_SLUG.$AUTO_DEVOPS_DOMAIN
...
...
qa/qa/page/project/operations/kubernetes/index.rb
View file @
7ab55880
...
...
@@ -17,6 +17,10 @@ module QA
def
has_cluster?
(
cluster
)
has_element?
(
:cluster
,
cluster_name:
cluster
.
to_s
)
end
def
click_on_cluster
(
cluster
)
click_on
cluster
.
cluster_name
end
end
end
end
...
...
qa/qa/page/project/operations/metrics/show.rb
View file @
7ab55880
...
...
@@ -25,6 +25,7 @@ module QA
element
:prometheus_graph_widgets
element
:prometheus_widgets_dropdown
element
:alert_widget_menu_item
element
:generate_chart_link_menu_item
end
def
wait_for_metrics
...
...
@@ -72,6 +73,11 @@ module QA
end
end
def
copy_link_to_first_chart
all_elements
(
:prometheus_widgets_dropdown
,
minimum:
1
).
first
.
click
find_element
(
:generate_chart_link_menu_item
)[
'data-clipboard-text'
]
end
private
def
wait_for_data
...
...
qa/qa/page/project/settings/incidents.rb
0 → 100644
View file @
7ab55880
# frozen_string_literal: true
module
QA
module
Page
module
Project
module
Settings
class
Incidents
<
Page
::
Base
view
'app/views/projects/settings/operations/_incidents.html.haml'
do
element
:create_issue_checkbox
element
:incident_templates_dropdown
element
:save_changes_button
end
def
enable_issues_for_incidents
check_element
:create_issue_checkbox
end
def
select_issue_template
(
template
)
within_element
:incident_templates_dropdown
do
find
(
:option
,
template
).
select_option
end
end
def
save_incident_settings
click_element
:save_changes_button
end
def
has_template?
(
template
)
within_element
:incident_templates_dropdown
do
has_text?
(
template
)
end
end
end
end
end
end
end
qa/qa/page/project/settings/operations.rb
0 → 100644
View file @
7ab55880
# frozen_string_literal: true
module
QA
module
Page
module
Project
module
Settings
class
Operations
<
Page
::
Base
include
Common
view
'app/views/projects/settings/operations/_incidents.html.haml'
do
element
:incidents_settings_content
end
def
expand_incidents
(
&
block
)
expand_section
(
:incidents_settings_content
)
do
Settings
::
Incidents
.
perform
(
&
block
)
end
end
end
end
end
end
end
qa/qa/page/project/sub_menus/operations.rb
View file @
7ab55880
...
...
@@ -10,7 +10,7 @@ module QA
def
self
.
included
(
base
)
base
.
class_eval
do
view
'app/views/layouts/nav/sidebar/_project.html.haml'
do
element
:
link_operations
element
:
operations_link
element
:operations_environments_link
element
:operations_metrics_link
end
...
...
@@ -45,8 +45,8 @@ module QA
def
hover_operations
within_sidebar
do
scroll_to_element
(
:
link_operations
)
find_element
(
:
link_operations
).
hover
scroll_to_element
(
:
operations_link
)
find_element
(
:
operations_link
).
hover
yield
end
...
...
qa/qa/page/project/sub_menus/settings.rb
View file @
7ab55880
...
...
@@ -14,6 +14,7 @@ module QA
element
:link_members_settings
element
:general_settings_link
element
:integrations_settings_link
element
:operations_settings_link
end
end
end
...
...
@@ -64,6 +65,14 @@ module QA
end
end
def
go_to_operations_settings
hover_settings
do
within_submenu
do
click_element
:operations_settings_link
end
end
end
private
def
hover_settings
...
...
qa/qa/specs/features/ee/browser_ui/8_monitor/.gitkeep
deleted
100644 → 0
View file @
e47f8abd
qa/qa/specs/features/ee/browser_ui/8_monitor/
health/alerting
_spec.rb
→
qa/qa/specs/features/ee/browser_ui/8_monitor/
all_monitor_features
_spec.rb
View file @
7ab55880
...
...
@@ -2,21 +2,39 @@
module
QA
context
'Monitor'
do
describe
'
Alerts'
,
:orchestrated
,
:kubernetes
do
before
do
describe
'
with Prometheus Gitlab-managed cluster'
,
:orchestrated
,
:kubernetes
,
:docker
do
before
:all
do
@cluster
=
Service
::
KubernetesCluster
.
new
.
create!
Flow
::
Login
.
sign_in
@project
,
@runner
=
deploy_project_with_prometheus
end
after
do
after
:all
do
@runner
.
remove_via_api!
@cluster
&
.
remove!
end
before
do
Flow
::
Login
.
sign_in_unless_signed_in
@project
.
visit!
end
it
'configures custom metrics'
do
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_metrics
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
metrics
|
metrics
.
add_custom_metric
end
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_metrics
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
metrics
|
expect
(
metrics
).
to
have_custom_metric
end
end
it
'allows configuration of alerts'
do
Flow
::
Login
.
sign_in
project
=
create_project
create_kubernetes_cluster
(
project
,
@cluster
)
push_repository
(
project
)
wait_for_deployment
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_metrics
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
metrics
|
verify_metrics
(
metrics
)
...
...
@@ -27,46 +45,77 @@ module QA
end
end
private
it
'observes cluster health graph'
do
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_kubernetes
)
Page
::
Project
::
Operations
::
Kubernetes
::
Index
.
perform
do
|
cluster
|
cluster
.
click_on_cluster
(
@cluster
)
end
Page
::
Project
::
Operations
::
Kubernetes
::
Show
.
perform
do
|
cluster
|
cluster
.
open_health
cluster
.
wait_for_cluster_health
end
end
it
'creates and sets an incident template'
do
create_incident_template
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_settings
)
def
create_project
Resource
::
Project
.
fabricate_via_api!
do
|
p
|
p
.
name
=
'alerts'
p
.
description
=
'Project with alerting configured'
Page
::
Project
::
Settings
::
Operations
.
perform
do
|
settings
|
settings
.
expand_incidents
do
|
incident_settings
|
incident_settings
.
enable_issues_for_incidents
incident_settings
.
select_issue_template
(
'incident'
)
incident_settings
.
save_incident_settings
end
settings
.
expand_incidents
do
|
incident_settings
|
expect
(
incident_settings
).
to
have_template
(
'incident'
)
end
end
end
private
def
deploy_project_with_prometheus
project
=
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'cluster-with-prometheus'
project
.
description
=
'Cluster with Prometheus'
end
def
create_kubernetes_cluster
(
project
,
cluster
)
Resource
::
KubernetesCluster
::
ProjectCluster
.
fabricate_via_browser_ui!
do
|
c
|
c
.
project
=
project
c
.
cluster
=
cluster
c
.
install_helm_tiller
=
true
c
.
install_prometheus
=
true
c
.
install_runner
=
true
runner
=
Resource
::
Runner
.
fabricate_via_api!
do
|
runner
|
runner
.
project
=
project
runner
.
name
=
project
.
name
end
cluster_props
=
Resource
::
KubernetesCluster
::
ProjectCluster
.
fabricate!
do
|
cluster
|
cluster
.
project
=
project
cluster
.
cluster
=
@cluster
cluster
.
install_helm_tiller
=
true
cluster
.
install_ingress
=
true
cluster
.
install_prometheus
=
true
end
def
push_repository
(
project
)
Resource
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
push
.
project
=
project
push
.
directory
=
Pathname
.
new
(
__dir__
)
.
join
(
'../
../../../../../fixtures/monitored_auto_devops'
)
push
.
commit_message
=
'Create Auto
DevOps compatible gitlab-ci.yml
'
.
join
(
'
../../../../../fixtures/monitored_auto_devops'
)
push
.
commit_message
=
'Create Auto
DevOps compatible Project for Monitoring
'
end
Resource
::
CiVariable
.
fabricate_via_api!
do
|
resource
|
resource
.
project
=
project
resource
.
key
=
'AUTO_DEVOPS_DOMAIN'
resource
.
value
=
'my-fake-domain.com'
resource
.
masked
=
false
end
Resource
::
CiVariable
.
fabricate_via_api!
do
|
ci_variable
|
ci_variable
.
project
=
project
ci_variable
.
key
=
'AUTO_DEVOPS_DOMAIN'
ci_variable
.
value
=
cluster_props
.
ingress_ip
ci_variable
.
masked
=
false
end
def
wait_for_deployment
Page
::
Project
::
Menu
.
perform
(
&
:click_ci_cd_pipelines
)
Page
::
Project
::
Pipeline
::
Index
.
perform
(
&
:wait_for_latest_pipeline_success_or_retry
)
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_metrics
)
[
project
,
runner
]
end
def
verify_metrics
(
metrics
)
...
...
@@ -101,6 +150,31 @@ module QA
expect
(
metrics
).
not_to
have_alert
(
'<'
)
end
def
create_incident_template
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_metrics
)
@chart_link
=
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
metric
|
metric
.
wait_for_metrics
metric
.
copy_link_to_first_chart
end
incident_template
=
"Incident Metric:
#{
@chart_link
}
"
push_template_to_repository
(
incident_template
)
end
def
push_template_to_repository
(
template
)
@project
.
visit!
Page
::
Project
::
Show
.
perform
(
&
:create_new_file!
)
Page
::
File
::
Form
.
perform
do
|
form
|
form
.
add_name
(
'.gitlab/issue_templates/incident.md'
)
form
.
add_content
(
template
)
form
.
add_commit_message
(
'Add Incident template'
)
form
.
commit_changes
end
end
end
end
end
qa/qa/specs/features/ee/browser_ui/8_monitor/apm/metrics_spec.rb
deleted
100644 → 0
View file @
e47f8abd
# frozen_string_literal: true
module
QA
context
'Monitor'
do
describe
'Metrics with Prometheus'
,
:orchestrated
,
:kubernetes
,
quarantine:
{
issue:
'https://gitlab.com/gitlab-org/gitlab/-/merge_requests/28436'
,
type: :waiting_on
}
do
before
do
@cluster
=
Service
::
KubernetesCluster
.
new
.
create!
Flow
::
Login
.
sign_in
create_project_to_monitor
wait_for_deployment
end
after
do
@cluster
&
.
remove!
end
it
'configures custom metrics in Prometheus running on a Kubernetes cluster'
do
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
metrics
|
metrics
.
add_custom_metric
end
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_metrics
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
metrics
|
expect
(
metrics
).
to
have_custom_metric
end
end
private
def
wait_for_deployment
Page
::
Project
::
Menu
.
perform
(
&
:click_ci_cd_pipelines
)
Page
::
Project
::
Pipeline
::
Index
.
perform
(
&
:wait_for_latest_pipeline_success_or_retry
)
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_metrics
)
end
def
create_project_to_monitor
@project
=
Resource
::
Project
.
fabricate_via_api!
do
|
p
|
p
.
name
=
'cluster-with-prometheus'
p
.
description
=
'Cluster with Prometheus'
end
@cluster_props
=
Resource
::
KubernetesCluster
::
ProjectCluster
.
fabricate_via_browser_ui!
do
|
c
|
c
.
project
=
@project
c
.
cluster
=
@cluster
c
.
install_helm_tiller
=
true
c
.
install_prometheus
=
true
c
.
install_ingress
=
true
end
Resource
::
CiVariable
.
fabricate_via_api!
do
|
resource
|
resource
.
project
=
@project
resource
.
key
=
'AUTO_DEVOPS_DOMAIN'
resource
.
value
=
@cluster_props
.
ingress_ip
resource
.
masked
=
false
end
Resource
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
push
.
project
=
@project
push
.
directory
=
Pathname
.
new
(
__dir__
)
.
join
(
'../../../../../../fixtures/monitored_auto_devops'
)
push
.
commit_message
=
'Create AutoDevOps compatible Project for Monitoring'
end
end
end
end
end
qa/qa/specs/features/ee/browser_ui/8_monitor/health/cluster_health_spec.rb
deleted
100644 → 0
View file @
e47f8abd
# frozen_string_literal: true
module
QA
context
'Monitor'
do
describe
'Cluster health graphs'
,
:orchestrated
,
:kubernetes
do
before
do
@cluster
=
Service
::
KubernetesCluster
.
new
.
create!
end
after
do
@cluster
&
.
remove!
end
it
'installs Kubernetes and Prometheus'
do
Flow
::
Login
.
sign_in
create_project
create_kubernetes_cluster
verify_cluster_health_graphs
end
private
def
create_project
@project
=
Resource
::
Project
.
fabricate_via_api!
do
|
p
|
p
.
name
=
'cluster-health'
p
.
description
=
'Cluster health'
end
end
def
create_kubernetes_cluster
Resource
::
KubernetesCluster
::
ProjectCluster
.
fabricate_via_browser_ui!
do
|
c
|
c
.
project
=
@project
c
.
cluster
=
@cluster
c
.
install_helm_tiller
=
true
c
.
install_prometheus
=
true
end
end
def
verify_cluster_health_graphs
Page
::
Project
::
Operations
::
Kubernetes
::
Show
.
perform
do
|
cluster
|
cluster
.
refresh
cluster
.
open_health
cluster
.
wait_for_cluster_health
end
end
end
end
end
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