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
1f3a4ac3
Commit
1f3a4ac3
authored
Jun 04, 2020
by
svistas
Committed by
Mark Lapierre
Jun 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix monitor tests and de-quarantine
parent
135d32dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
145 additions
and
110 deletions
+145
-110
qa/qa/specs/features/browser_ui/8_monitor/all_monitor_core_features_spec.rb
...es/browser_ui/8_monitor/all_monitor_core_features_spec.rb
+64
-47
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
+81
-63
No files found.
qa/qa/specs/features/browser_ui/8_monitor/all_monitor_core_features_spec.rb
View file @
1f3a4ac3
# frozen_string_literal: true
module
QA
context
'Monitor'
,
quarantine:
{
issue:
'https://gitlab.com/gitlab-org/gitlab/-/issues/217705'
,
type: :flaky
}
do
describe
'with Prometheus
Gitlab-managed cluster'
,
:orchestrated
,
:kubernetes
,
:docker
,
:runner
do
context
'Monitor'
do
describe
'with Prometheus
in a Gitlab-managed cluster'
,
:orchestrated
,
:kubernetes
do
before
:all
do
Flow
::
Login
.
sign_in
@project
,
@runner
=
deploy_project_with_prometheus
@cluster
=
Service
::
KubernetesCluster
.
new
.
create!
@project
=
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'monitoring-project'
project
.
auto_devops_enabled
=
true
end
deploy_project_with_prometheus
end
before
do
...
...
@@ -14,7 +19,6 @@ module QA
end
after
:all
do
@runner
.
remove_via_api!
@cluster
.
remove!
end
...
...
@@ -27,81 +31,94 @@ module QA
it
'duplicates to create dashboard to custom'
do
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_metrics
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
dashboard
|
dashboard
.
duplicate_dashboard
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
on_
dashboard
|
on_
dashboard
.
duplicate_dashboard
expect
(
dashboard
).
to
have_metrics
expect
(
dashboard
).
to
have_edit_dashboard_enabled
expect
(
on_
dashboard
).
to
have_metrics
expect
(
on_
dashboard
).
to
have_edit_dashboard_enabled
end
end
it
'verifies data on filtered deployed environment'
do
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_metrics
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
dashboard
|
dashboard
.
filter_environment
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
on_
dashboard
|
on_
dashboard
.
filter_environment
expect
(
dashboard
).
to
have_metrics
expect
(
on_
dashboard
).
to
have_metrics
end
end
it
'filters using the quick range'
do
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_metrics
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
dashboard
|
dashboard
.
show_last
(
'30 minutes'
)
expect
(
dashboard
).
to
have_metrics
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
on_
dashboard
|
on_
dashboard
.
show_last
(
'30 minutes'
)
expect
(
on_
dashboard
).
to
have_metrics
dashboard
.
show_last
(
'3 hours'
)
expect
(
dashboard
).
to
have_metrics
on_
dashboard
.
show_last
(
'3 hours'
)
expect
(
on_
dashboard
).
to
have_metrics
dashboard
.
show_last
(
'1 day'
)
expect
(
dashboard
).
to
have_metrics
on_
dashboard
.
show_last
(
'1 day'
)
expect
(
on_
dashboard
).
to
have_metrics
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'
%w[
CODE_QUALITY_DISABLED TEST_DISABLED LICENSE_MANAGEMENT_DISABLED
SAST_DISABLED DAST_DISABLED DEPENDENCY_SCANNING_DISABLED
CONTAINER_SCANNING_DISABLED PERFORMANCE_DISABLED
]
.
each
do
|
key
|
Resource
::
CiVariable
.
fabricate_via_api!
do
|
resource
|
resource
.
project
=
@project
resource
.
key
=
key
resource
.
value
=
'1'
resource
.
masked
=
false
end
end
runner
=
Resource
::
Runner
.
fabricate_via_api!
do
|
runner
|
runner
.
project
=
project
runner
.
name
=
project
.
name
end
@cluster
=
Service
::
KubernetesCluster
.
new
.
create!
Flow
::
Login
.
sign_in
cluster_props
=
Resource
::
KubernetesCluster
::
ProjectCluster
.
fabricate!
do
|
cluster_settings
|
cluster_settings
.
project
=
project
Resource
::
KubernetesCluster
::
ProjectCluster
.
fabricate!
do
|
cluster_settings
|
cluster_settings
.
project
=
@
project
cluster_settings
.
cluster
=
@cluster
cluster_settings
.
install_helm_tiller
=
true
cluster_settings
.
install_runner
=
true
cluster_settings
.
install_ingress
=
true
cluster_settings
.
install_prometheus
=
true
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
Resource
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
push
.
project
=
project
push
.
project
=
@
project
push
.
directory
=
Pathname
.
new
(
__dir__
)
.
join
(
'../../../../fixtures/
monitored_auto_devops
'
)
.
join
(
'../../../../fixtures/
auto_devops_rack
'
)
push
.
commit_message
=
'Create AutoDevOps compatible Project for Monitoring'
end
Page
::
Project
::
Menu
.
perform
(
&
:click_ci_cd_pipelines
)
Page
::
Project
::
Pipeline
::
Index
.
perform
(
&
:wait_for_latest_pipeline_success_or_retry
)
Page
::
Project
::
Pipeline
::
Index
.
perform
(
&
:click_on_latest_pipeline
)
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
pipeline
|
pipeline
.
click_job
(
'build'
)
end
Page
::
Project
::
Job
::
Show
.
perform
do
|
job
|
expect
(
job
).
to
be_successful
(
timeout:
600
)
job
.
click_element
(
:pipeline_path
)
end
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
pipeline
|
pipeline
.
click_job
(
'production'
)
end
Page
::
Project
::
Job
::
Show
.
perform
do
|
job
|
expect
(
job
).
to
be_successful
(
timeout:
1200
)
[
project
,
runner
]
job
.
click_element
(
:pipeline_path
)
end
end
def
verify_add_custom_metric
...
...
@@ -115,8 +132,8 @@ module QA
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_metrics
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
dashboard
|
expect
(
dashboard
).
to
have_custom_metric
(
'HTTP Requests Total'
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
on_
dashboard
|
expect
(
on_
dashboard
).
to
have_custom_metric
(
'HTTP Requests Total'
)
end
end
...
...
@@ -130,8 +147,8 @@ module QA
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_metrics
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
dashboard
|
expect
(
dashboard
).
to
have_custom_metric
(
'Throughput'
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
on_
dashboard
|
expect
(
on_
dashboard
).
to
have_custom_metric
(
'Throughput'
)
end
end
...
...
@@ -146,8 +163,8 @@ module QA
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_metrics
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
dashboard
|
expect
(
dashboard
).
not_to
have_custom_metric
(
'Throughput'
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
on_
dashboard
|
expect
(
on_
dashboard
).
not_to
have_custom_metric
(
'Throughput'
)
end
end
end
...
...
qa/qa/specs/features/ee/browser_ui/8_monitor/all_monitor_features_spec.rb
View file @
1f3a4ac3
# frozen_string_literal: true
require
'pathname'
module
QA
context
'Monitor'
,
quarantine:
{
issue:
'https://gitlab.com/gitlab-org/gitlab/-/issues/217705'
,
type: :flaky
}
do
describe
'with Prometheus
Gitlab-managed cluster'
,
:orchestrated
,
:kubernetes
,
:docker
,
:runner
do
context
'Monitor'
do
describe
'with Prometheus
in a Gitlab-managed cluster'
,
:orchestrated
,
:kubernetes
do
before
:all
do
@cluster
=
Service
::
KubernetesCluster
.
new
.
create!
Flow
::
Login
.
sign_in
@project
,
@runner
=
deploy_project_with_prometheus
@project
=
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'monitoring-project'
project
.
auto_devops_enabled
=
true
end
deploy_project_with_prometheus
end
after
:all
do
@runner
&
.
remove_via_api!
@cluster
&
.
remove!
@cluster
.
remove!
end
before
do
...
...
@@ -22,26 +26,25 @@ module QA
it
'allows configuration of alerts'
do
Page
::
Project
::
Menu
.
perform
(
&
:go_to_operations_metrics
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
metrics
|
verify_metrics
(
metrics
)
verify_add_alert
(
metrics
)
verify_edit_alert
(
metrics
)
verify_persist_alert
(
metrics
)
verify_delete_alert
(
metrics
)
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
on_dashboard
|
verify_metrics
(
on_dashboard
)
verify_add_alert
(
on_dashboard
)
verify_edit_alert
(
on_dashboard
)
verify_persist_alert
(
on_dashboard
)
verify_delete_alert
(
on_dashboard
)
end
end
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
)
Page
::
Project
::
Operations
::
Kubernetes
::
Index
.
perform
do
|
cluster
_list
|
cluster
_list
.
click_on_cluster
(
@cluster
)
end
Page
::
Project
::
Operations
::
Kubernetes
::
Show
.
perform
do
|
cluster
|
cluster
.
open_health
cluster
.
wait_for_cluster_health
Page
::
Project
::
Operations
::
Kubernetes
::
Show
.
perform
do
|
cluster_panel
|
cluster_panel
.
open_health
cluster_panel
.
wait_for_cluster_health
end
end
...
...
@@ -65,87 +68,102 @@ module QA
private
def
deploy_project_with_prometheus
project
=
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'cluster-with-prometheus'
project
.
description
=
'Cluster with Prometheus'
%w[
CODE_QUALITY_DISABLED TEST_DISABLED LICENSE_MANAGEMENT_DISABLED
SAST_DISABLED DAST_DISABLED DEPENDENCY_SCANNING_DISABLED
CONTAINER_SCANNING_DISABLED PERFORMANCE_DISABLED
]
.
each
do
|
key
|
Resource
::
CiVariable
.
fabricate_via_api!
do
|
resource
|
resource
.
project
=
@project
resource
.
key
=
key
resource
.
value
=
'1'
resource
.
masked
=
false
end
end
runner
=
Resource
::
Runner
.
fabricate_via_api!
do
|
runner
|
runner
.
project
=
project
runner
.
name
=
project
.
name
end
Flow
::
Login
.
sign_in
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
Resource
::
KubernetesCluster
::
ProjectCluster
.
fabricate!
do
|
cluster_settings
|
cluster_settings
.
project
=
@project
cluster_settings
.
cluster
=
@cluster
cluster_settings
.
install_helm_tiller
=
true
cluster_settings
.
install_runner
=
true
cluster_settings
.
install_ingress
=
true
cluster_settings
.
install_prometheus
=
true
end
Resource
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
push
.
project
=
project
push
.
project
=
@
project
push
.
directory
=
Pathname
.
new
(
__dir__
)
.
join
(
'../../../../../fixtures/
monitored_auto_devops
'
)
.
join
(
'../../../../../fixtures/
auto_devops_rack
'
)
push
.
commit_message
=
'Create AutoDevOps compatible Project for Monitoring'
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
Page
::
Project
::
Menu
.
perform
(
&
:click_ci_cd_pipelines
)
Page
::
Project
::
Pipeline
::
Index
.
perform
(
&
:click_on_latest_pipeline
)
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
pipeline
|
pipeline
.
click_job
(
'build'
)
end
Page
::
Project
::
Job
::
Show
.
perform
do
|
job
|
expect
(
job
).
to
be_successful
(
timeout:
600
)
Page
::
Project
::
Menu
.
perform
(
&
:click_ci_cd_pipelines
)
Page
::
Project
::
Pipeline
::
Index
.
perform
(
&
:wait_for_latest_pipeline_success_or_retry
)
job
.
click_element
(
:pipeline_path
)
end
[
project
,
runner
]
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
pipeline
|
pipeline
.
click_job
(
'production'
)
end
Page
::
Project
::
Job
::
Show
.
perform
do
|
job
|
expect
(
job
).
to
be_successful
(
timeout:
1200
)
job
.
click_element
(
:pipeline_path
)
end
end
def
verify_metrics
(
metrics
)
metrics
.
wait_for_metrics
def
verify_metrics
(
on_dashboard
)
on_dashboard
.
wait_for_metrics
expect
(
metrics
).
to
have_metrics
expect
(
metrics
).
not_to
have_alert
expect
(
on_dashboard
).
to
have_metrics
expect
(
on_dashboard
).
not_to
have_alert
end
def
verify_add_alert
(
metrics
)
metrics
.
write_first_alert
(
'>'
,
0
)
def
verify_add_alert
(
on_dashboard
)
on_dashboard
.
write_first_alert
(
'>'
,
0
)
expect
(
metrics
).
to
have_alert
expect
(
on_dashboard
).
to
have_alert
end
def
verify_edit_alert
(
metrics
)
metrics
.
write_first_alert
(
'<'
,
0
)
def
verify_edit_alert
(
on_dashboard
)
on_dashboard
.
write_first_alert
(
'<'
,
0
)
expect
(
metrics
).
to
have_alert
(
'<'
)
expect
(
on_dashboard
).
to
have_alert
(
'<'
)
end
def
verify_persist_alert
(
metrics
)
metrics
.
refresh
metrics
.
wait_for_metrics
metrics
.
wait_for_alert
(
'<'
)
def
verify_persist_alert
(
on_dashboard
)
on_dashboard
.
refresh
on_dashboard
.
wait_for_metrics
on_dashboard
.
wait_for_alert
(
'<'
)
expect
(
metrics
).
to
have_alert
(
'<'
)
expect
(
on_dashboard
).
to
have_alert
(
'<'
)
end
def
verify_delete_alert
(
metrics
)
metrics
.
delete_first_alert
def
verify_delete_alert
(
on_dashboard
)
on_dashboard
.
delete_first_alert
expect
(
metrics
).
not_to
have_alert
(
'<'
)
expect
(
on_dashboard
).
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
chart_link
=
Page
::
Project
::
Operations
::
Metrics
::
Show
.
perform
do
|
on_dashboard
|
on_dashboard
.
wait_for_metrics
on_dashboard
.
copy_link_to_first_chart
end
incident_template
=
"Incident Metric:
#{
@
chart_link
}
"
incident_template
=
"Incident Metric:
#{
chart_link
}
"
push_template_to_repository
(
incident_template
)
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