diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-05 00:08:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-05 00:08:43 +0300 |
commit | f9269785d97e5bdcae6bfce3f09029b5ccdf104d (patch) | |
tree | ffd248e02247b7a7db7b584c459355d88afc5e4d /spec | |
parent | f2f95cc1bac06c8b4e506f02c1b90754adda67ec (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
7 files changed, 11 insertions, 141 deletions
diff --git a/spec/frontend/snippets/components/snippet_visibility_edit_spec.js b/spec/frontend/snippets/components/snippet_visibility_edit_spec.js index 70eb719f706..e2a9967f6ad 100644 --- a/spec/frontend/snippets/components/snippet_visibility_edit_spec.js +++ b/spec/frontend/snippets/components/snippet_visibility_edit_spec.js @@ -134,6 +134,17 @@ describe('Snippet Visibility Edit component', () => { description: SNIPPET_VISIBILITY.private.description_project, }); }); + + it('when project snippet, renders special public description', () => { + createComponent({ propsData: { isProjectSnippet: true }, deep: true }); + + expect(findRadiosData()[2]).toEqual({ + value: VISIBILITY_LEVEL_PUBLIC_STRING, + icon: SNIPPET_VISIBILITY.public.icon, + text: SNIPPET_VISIBILITY.public.label, + description: SNIPPET_VISIBILITY.public.description_project, + }); + }); }); }); diff --git a/spec/graphql/types/alert_management/alert_type_spec.rb b/spec/graphql/types/alert_management/alert_type_spec.rb index 4428fc0683a..92e8104fc4d 100644 --- a/spec/graphql/types/alert_management/alert_type_spec.rb +++ b/spec/graphql/types/alert_management/alert_type_spec.rb @@ -31,7 +31,6 @@ RSpec.describe GitlabSchema.types['AlertManagementAlert'], feature_category: :in assignees notes discussions - metrics_dashboard_url runbook todos details_url diff --git a/spec/lib/gitlab/alert_management/payload/managed_prometheus_spec.rb b/spec/lib/gitlab/alert_management/payload/managed_prometheus_spec.rb index fa8afd47c53..d7184c89933 100644 --- a/spec/lib/gitlab/alert_management/payload/managed_prometheus_spec.rb +++ b/spec/lib/gitlab/alert_management/payload/managed_prometheus_spec.rb @@ -150,20 +150,4 @@ RSpec.describe Gitlab::AlertManagement::Payload::ManagedPrometheus do it { is_expected.to eq(environment) } end end - - describe '#metrics_dashboard_url' do - subject { parsed_payload.metrics_dashboard_url } - - context 'without alert' do - it { is_expected.to be_nil } - end - - context 'with gitlab alert' do - include_context 'gitlab-managed prometheus alert attributes' do - let(:raw_payload) { payload } - end - - it { is_expected.to eq(dashboard_url_for_alert) } - end - end end diff --git a/spec/lib/gitlab/alert_management/payload/prometheus_spec.rb b/spec/lib/gitlab/alert_management/payload/prometheus_spec.rb index cf525801aa0..92836915f7b 100644 --- a/spec/lib/gitlab/alert_management/payload/prometheus_spec.rb +++ b/spec/lib/gitlab/alert_management/payload/prometheus_spec.rb @@ -178,32 +178,6 @@ RSpec.describe Gitlab::AlertManagement::Payload::Prometheus do end end - describe '#metrics_dashboard_url' do - include_context 'self-managed prometheus alert attributes' do - let(:raw_payload) { payload } - end - - subject { parsed_payload.metrics_dashboard_url } - - context 'without environment' do - let(:raw_payload) { payload.except('labels') } - - it { is_expected.to be_nil } - end - - context 'without full query' do - let(:raw_payload) { payload.except('generatorURL') } - - it { is_expected.to be_nil } - end - - context 'without title' do - let(:raw_payload) { payload.except('annotations') } - - it { is_expected.to be_nil } - end - end - describe '#has_required_attributes?' do let(:starts_at) { Time.current.change(usec: 0).utc } let(:raw_payload) { { 'annotations' => { 'title' => 'title' }, 'startsAt' => starts_at.rfc3339 } } diff --git a/spec/presenters/alert_management/alert_presenter_spec.rb b/spec/presenters/alert_management/alert_presenter_spec.rb index fe228f174fe..eedb2e07fb6 100644 --- a/spec/presenters/alert_management/alert_presenter_spec.rb +++ b/spec/presenters/alert_management/alert_presenter_spec.rb @@ -91,24 +91,6 @@ RSpec.describe AlertManagement::AlertPresenter do ) end end - - context 'with metrics_dashboard_url' do - before do - allow(alert.parsed_payload).to receive(:metrics_dashboard_url).and_return('https://gitlab.com/metrics') - end - - it do - is_expected.to eq( - <<~MARKDOWN.chomp - **Start time:** #{presenter.start_time}#{markdown_line_break} - **Severity:** #{presenter.severity}#{markdown_line_break} - **GitLab alert:** #{alert_url} - - [](https://gitlab.com/metrics) - MARKDOWN - ) - end - end end describe '#start_time' do diff --git a/spec/requests/api/graphql/project/alert_management/alert/metrics_dashboard_url_spec.rb b/spec/requests/api/graphql/project/alert_management/alert/metrics_dashboard_url_spec.rb deleted file mode 100644 index 2c49c9bc47b..00000000000 --- a/spec/requests/api/graphql/project/alert_management/alert/metrics_dashboard_url_spec.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'getting Alert Management Alert Assignees', feature_category: :incident_management do - include GraphqlHelpers - - let_it_be(:project) { create(:project) } - let_it_be(:current_user) { create(:user) } - - let(:fields) do - <<~QUERY - nodes { - iid - metricsDashboardUrl - } - QUERY - end - - let(:graphql_query) do - graphql_query_for( - 'project', - { 'fullPath' => project.full_path }, - query_graphql_field('alertManagementAlerts', {}, fields) - ) - end - - let(:alerts) { graphql_data.dig('project', 'alertManagementAlerts', 'nodes') } - let(:first_alert) { alerts.first } - - before do - stub_feature_flags(remove_monitor_metrics: false) - project.add_developer(current_user) - end - - context 'with self-managed prometheus payload' do - include_context 'self-managed prometheus alert attributes' - - before do - create(:alert_management_alert, :prometheus, project: project, payload: payload) - end - - context 'when metrics dashboard feature is unavailable' do - before do - stub_feature_flags(remove_monitor_metrics: true) - end - - it 'returns nil' do - post_graphql(graphql_query, current_user: current_user) - expect(first_alert['metricsDashboardUrl']).to be_nil - end - end - end - - context 'with gitlab-managed prometheus payload' do - include_context 'gitlab-managed prometheus alert attributes' - - before do - create(:alert_management_alert, :prometheus, project: project, payload: payload, prometheus_alert: prometheus_alert) - end - - it 'includes the correct metrics dashboard url' do - post_graphql(graphql_query, current_user: current_user) - - expect(first_alert).to include('metricsDashboardUrl' => dashboard_url_for_alert) - end - - context 'when metrics dashboard feature is unavailable' do - before do - stub_feature_flags(remove_monitor_metrics: true) - end - - it 'returns nil' do - post_graphql(graphql_query, current_user: current_user) - expect(first_alert['metricsDashboardUrl']).to be_nil - end - end - end -end diff --git a/spec/requests/api/graphql/project/alert_management/alerts_spec.rb b/spec/requests/api/graphql/project/alert_management/alerts_spec.rb index 55d223daf27..7f586edd510 100644 --- a/spec/requests/api/graphql/project/alert_management/alerts_spec.rb +++ b/spec/requests/api/graphql/project/alert_management/alerts_spec.rb @@ -74,7 +74,6 @@ RSpec.describe 'getting Alert Management Alerts', feature_category: :incident_ma 'details' => { 'custom.alert' => 'payload', 'runbook' => 'runbook' }, 'createdAt' => triggered_alert.created_at.strftime('%Y-%m-%dT%H:%M:%SZ'), 'updatedAt' => triggered_alert.updated_at.strftime('%Y-%m-%dT%H:%M:%SZ'), - 'metricsDashboardUrl' => nil, 'detailsUrl' => triggered_alert.details_url, 'prometheusAlert' => nil, 'runbook' => 'runbook' |