diff options
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/database_spec.rb | 6 | ||||
-rw-r--r-- | spec/lib/gitlab/gitaly_client/commit_service_spec.rb | 13 | ||||
-rw-r--r-- | spec/lib/gitlab/metrics/dashboard/processor_spec.rb | 15 |
3 files changed, 33 insertions, 1 deletions
diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb index 4a0eab3ea27..b99f311de29 100644 --- a/spec/lib/gitlab/database_spec.rb +++ b/spec/lib/gitlab/database_spec.rb @@ -394,6 +394,12 @@ describe Gitlab::Database do expect(described_class.cached_table_exists?(:bogus_table_name)).to be_falsey end end + + it 'returns false when database does not exist' do + expect(ActiveRecord::Base).to receive(:connection) { raise ActiveRecord::NoDatabaseError, 'broken' } + + expect(described_class.cached_table_exists?(:projects)).to be(false) + end end describe '.exists?' do diff --git a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb index 5e1d6199c3c..5c36d6d35af 100644 --- a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb @@ -281,6 +281,19 @@ describe Gitlab::GitalyClient::CommitService do end describe '#find_commits' do + it 'sends an RPC request with NONE when default' do + request = Gitaly::FindCommitsRequest.new( + repository: repository_message, + disable_walk: true, + order: 'NONE' + ) + + expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:find_commits) + .with(request, kind_of(Hash)).and_return([]) + + client.find_commits(order: 'default') + end + it 'sends an RPC request' do request = Gitaly::FindCommitsRequest.new( repository: repository_message, diff --git a/spec/lib/gitlab/metrics/dashboard/processor_spec.rb b/spec/lib/gitlab/metrics/dashboard/processor_spec.rb index 8c3942c7f7d..e8860d50437 100644 --- a/spec/lib/gitlab/metrics/dashboard/processor_spec.rb +++ b/spec/lib/gitlab/metrics/dashboard/processor_spec.rb @@ -12,6 +12,7 @@ describe Gitlab::Metrics::Dashboard::Processor do [ Gitlab::Metrics::Dashboard::Stages::CommonMetricsInserter, Gitlab::Metrics::Dashboard::Stages::ProjectMetricsInserter, + Gitlab::Metrics::Dashboard::Stages::ProjectMetricsDetailsInserter, Gitlab::Metrics::Dashboard::Stages::EndpointInserter, Gitlab::Metrics::Dashboard::Stages::Sorter ] @@ -25,6 +26,10 @@ describe Gitlab::Metrics::Dashboard::Processor do end end + it 'includes boolean to indicate if panel group has custom metrics' do + expect(dashboard[:panel_groups]).to all(include( { has_custom_metrics: boolean } )) + end + context 'when the dashboard is not present' do let(:dashboard_yml) { nil } @@ -145,7 +150,8 @@ describe Gitlab::Metrics::Dashboard::Processor do unit: metric.unit, label: metric.legend, metric_id: metric.id, - prometheus_endpoint_path: prometheus_path(metric.query) + prometheus_endpoint_path: prometheus_path(metric.query), + edit_path: edit_metric_path(metric) } end @@ -165,4 +171,11 @@ describe Gitlab::Metrics::Dashboard::Processor do identifier: metric ) end + + def edit_metric_path(metric) + Gitlab::Routing.url_helpers.edit_project_prometheus_metric_path( + project, + metric.id + ) + end end |