diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-28 12:11:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-28 12:11:43 +0300 |
commit | c00c766f13d6e0291831a25434eb54057708cc47 (patch) | |
tree | b1db8dd9d5b109486f107be231dc0edb82457d61 /spec/services | |
parent | 99f384810fcb98be5dc45c22552eb80a76021387 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
3 files changed, 0 insertions, 139 deletions
diff --git a/spec/services/metrics/dashboard/clone_dashboard_service_spec.rb b/spec/services/metrics/dashboard/clone_dashboard_service_spec.rb index bb11b905a7c..0818bdd8b9c 100644 --- a/spec/services/metrics/dashboard/clone_dashboard_service_spec.rb +++ b/spec/services/metrics/dashboard/clone_dashboard_service_spec.rb @@ -87,11 +87,6 @@ RSpec.describe Metrics::Dashboard::CloneDashboardService, :use_clean_rails_memor ::Gitlab::Metrics::Dashboard::Stages::CustomMetricsInserter ] - it_behaves_like 'valid dashboard cloning process', ::Metrics::Dashboard::ClusterDashboardService::DASHBOARD_PATH, - [ - ::Gitlab::Metrics::Dashboard::Stages::CommonMetricsInserter - ] - context 'selected branch already exists' do let(:branch) { 'existing_branch' } diff --git a/spec/services/metrics/dashboard/cluster_dashboard_service_spec.rb b/spec/services/metrics/dashboard/cluster_dashboard_service_spec.rb deleted file mode 100644 index 53def716de3..00000000000 --- a/spec/services/metrics/dashboard/cluster_dashboard_service_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Metrics::Dashboard::ClusterDashboardService, :use_clean_rails_memory_store_caching, - feature_category: :metrics do - include MetricsDashboardHelpers - - let_it_be(:user) { create(:user) } - let_it_be(:cluster_project) { create(:cluster_project) } - let_it_be(:cluster) { cluster_project.cluster } - let_it_be(:project) { cluster_project.project } - - before do - project.add_maintainer(user) - end - - describe '.valid_params?' do - let(:params) { { cluster: cluster, embedded: 'false' } } - - subject { described_class.valid_params?(params) } - - it { is_expected.to be_truthy } - - context 'with matching dashboard_path' do - let(:params) { { dashboard_path: ::Metrics::Dashboard::ClusterDashboardService::DASHBOARD_PATH } } - - it { is_expected.to be_truthy } - end - - context 'missing cluster without dashboard_path' do - let(:params) { {} } - - it { is_expected.to be_falsey } - end - end - - describe '#get_dashboard' do - let(:service_params) { [project, user, { cluster: cluster, cluster_type: :admin }] } - let(:service_call) { subject.get_dashboard } - - subject { described_class.new(*service_params) } - - it_behaves_like 'valid dashboard service response' - it_behaves_like 'caches the unprocessed dashboard for subsequent calls' - it_behaves_like 'refreshes cache when dashboard_version is changed' - - it_behaves_like 'dashboard_version contains SHA256 hash of dashboard file content' do - let(:dashboard_path) { described_class::DASHBOARD_PATH } - let(:dashboard_version) { subject.send(:dashboard_version) } - end - - context 'when called with a non-system dashboard' do - let(:dashboard_path) { 'garbage/dashboard/path' } - - # We want to always return the cluster dashboard. - it_behaves_like 'valid dashboard service response' - end - end -end diff --git a/spec/services/metrics/dashboard/cluster_metrics_embed_service_spec.rb b/spec/services/metrics/dashboard/cluster_metrics_embed_service_spec.rb deleted file mode 100644 index 5d63505e5cc..00000000000 --- a/spec/services/metrics/dashboard/cluster_metrics_embed_service_spec.rb +++ /dev/null @@ -1,74 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Metrics::Dashboard::ClusterMetricsEmbedService, :use_clean_rails_memory_store_caching, - feature_category: :metrics do - include MetricsDashboardHelpers - using RSpec::Parameterized::TableSyntax - - let_it_be(:user) { create(:user) } - let_it_be(:cluster_project) { create(:cluster_project) } - let_it_be(:cluster) { cluster_project.cluster } - let_it_be(:project) { cluster_project.project } - - before do - project.add_maintainer(user) - end - - describe '.valid_params?' do - let(:valid_params) { { cluster: 1, embedded: 'true', group: 'hello', title: 'world', y_label: 'countries' } } - - subject { described_class } - - it { expect(subject.valid_params?(valid_params)).to be_truthy } - - context 'missing all params' do - let(:params) { {} } - - it { expect(subject.valid_params?(params)).to be_falsy } - end - - [:cluster, :embedded, :group, :title, :y_label].each do |param_key| - it 'returns false with missing param' do - params = valid_params.except(param_key) - - expect(subject.valid_params?(params)).to be_falsy - end - end - end - - describe '#get_dashboard' do - let(:service_params) do - [ - project, - user, - { - cluster: cluster, - cluster_type: :project, - embedded: 'true', - group: 'Cluster Health', - title: 'CPU Usage', - y_label: 'CPU (cores)' - } - ] - end - - let(:service_call) { described_class.new(*service_params).get_dashboard } - let(:panel_groups) { service_call[:dashboard][:panel_groups] } - let(:panel) { panel_groups.first[:panels].first } - - it_behaves_like 'valid embedded dashboard service response' - it_behaves_like 'caches the unprocessed dashboard for subsequent calls' - - it 'returns one panel' do - expect(panel_groups.size).to eq 1 - expect(panel_groups.first[:panels].size).to eq 1 - end - - it 'returns panel by title and y_label' do - expect(panel[:title]).to eq(service_params.last[:title]) - expect(panel[:y_label]).to eq(service_params.last[:y_label]) - end - end -end |