From 93dcf45d441bc884b167f4338380c8c888e9b86f Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 2 Apr 2020 00:08:11 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../fixtures/monitored_auto_devops/.gitlab-ci.yml | 2 +- qa/qa/page/project/operations/metrics/show.rb | 37 +++++++++ qa/qa/page/project/pipeline/index.rb | 2 +- .../repository/protocol_v2_push_ssh_spec.rb | 3 +- .../browser_ui/8_monitor/apm/dashboards_spec.rb | 97 ++++++++++++++++++++++ 5 files changed, 137 insertions(+), 4 deletions(-) create mode 100644 qa/qa/specs/features/browser_ui/8_monitor/apm/dashboards_spec.rb (limited to 'qa') diff --git a/qa/qa/fixtures/monitored_auto_devops/.gitlab-ci.yml b/qa/qa/fixtures/monitored_auto_devops/.gitlab-ci.yml index d8ca7b591ed..3e83c8f0f77 100644 --- a/qa/qa/fixtures/monitored_auto_devops/.gitlab-ci.yml +++ b/qa/qa/fixtures/monitored_auto_devops/.gitlab-ci.yml @@ -22,7 +22,7 @@ variables: stages: - production -# This job continuously deploys to production on every push to `master`. +# This job continuously deploys to staging/production on every push to `master`. production: stage: production diff --git a/qa/qa/page/project/operations/metrics/show.rb b/qa/qa/page/project/operations/metrics/show.rb index c94c1f6590f..020a3a1d5f8 100644 --- a/qa/qa/page/project/operations/metrics/show.rb +++ b/qa/qa/page/project/operations/metrics/show.rb @@ -11,6 +11,14 @@ module QA view 'app/assets/javascripts/monitoring/components/dashboard.vue' do element :prometheus_graphs + element :dashboards_filter_dropdown + element :environments_dropdown + element :edit_dashboard_button + element :show_last_dropdown + end + + view 'app/assets/javascripts/monitoring/components/duplicate_dashboard_form.vue' do + element :duplicate_dashboard_filename_field end view 'app/assets/javascripts/monitoring/components/panel_type.vue' do @@ -35,6 +43,35 @@ module QA end end + def has_edit_dashboard_enabled? + within_element :prometheus_graphs do + has_element? :edit_dashboard_button + end + end + + def duplicate_dashboard(save_as = 'test_duplication.yml', commit_option = 'Commit to master branch') + click_element :dashboards_filter_dropdown + click_on 'Duplicate dashboard' + fill_element :duplicate_dashboard_filename_field, save_as + choose commit_option + within('.modal-content') { click_button(class: 'btn-success') } + end + + def filter_environment(environment = 'production') + click_element :environments_dropdown + + within_element :environments_dropdown do + click_link_with_text environment + end + end + + def show_last(range = '8 hours') + click_element :show_last_dropdown + within_element :show_last_dropdown do + click_on range + end + end + private def wait_for_data diff --git a/qa/qa/page/project/pipeline/index.rb b/qa/qa/page/project/pipeline/index.rb index f9332e0a853..327eedeaf91 100644 --- a/qa/qa/page/project/pipeline/index.rb +++ b/qa/qa/page/project/pipeline/index.rb @@ -25,7 +25,7 @@ module QA::Page end def wait_for_latest_pipeline_status - wait_until(reload: false, max_duration: 300) do + wait_until(reload: false, max_duration: 360) do within_element_by_index(:pipeline_commit_status, 0) { yield } end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_ssh_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_ssh_spec.rb index ec00091b3ce..e3d5b755317 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_ssh_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_ssh_spec.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true module QA - # Git protocol v2 is temporarily disabled - context 'Create', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/issues/27828', type: :bug } do + context 'Create' do describe 'Push over SSH using Git protocol version 2', :requires_git_protocol_v2 do # Note: If you run this test against GDK make sure you've enabled sshd and # enabled setting the Git protocol by adding `AcceptEnv GIT_PROTOCOL` to diff --git a/qa/qa/specs/features/browser_ui/8_monitor/apm/dashboards_spec.rb b/qa/qa/specs/features/browser_ui/8_monitor/apm/dashboards_spec.rb new file mode 100644 index 00000000000..f7463c69db1 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/8_monitor/apm/dashboards_spec.rb @@ -0,0 +1,97 @@ +# frozen_string_literal: true + +module QA + context 'Monitor' do + describe 'Dashboards', :orchestrated, :kubernetes, quarantine: { type: :new } do + before(:all) do + @cluster = Service::KubernetesCluster.new.create! + Flow::Login.sign_in + create_project_to_monitor + wait_for_deployment + end + + before do + Flow::Login.sign_in_unless_signed_in + @project.visit! + end + + after(:all) do + @cluster&.remove! + end + + 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 + + expect(dashboard).to have_metrics + expect(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 + + expect(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 + + dashboard.show_last('3 hours') + expect(dashboard).to have_metrics + + dashboard.show_last('1 day') + expect(dashboard).to have_metrics + 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 |project| + project.name = 'cluster-with-prometheus' + project.description = 'Cluster with Prometheus' + end + + @cluster_props = Resource::KubernetesCluster.fabricate_via_browser_ui! do |cluster_settings| + cluster_settings.project = @project + cluster_settings.cluster = @cluster + cluster_settings.install_helm_tiller = 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.directory = Pathname + .new(__dir__) + .join('../../../../../fixtures/monitored_auto_devops') + push.commit_message = 'Create AutoDevOps compatible Project for Monitoring' + end + end + end + end +end -- cgit v1.2.3