diff options
Diffstat (limited to 'spec/support/helpers/usage_data_helpers.rb')
-rw-r--r-- | spec/support/helpers/usage_data_helpers.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/support/helpers/usage_data_helpers.rb b/spec/support/helpers/usage_data_helpers.rb index 382e4f6a1a4..f6c415a75bc 100644 --- a/spec/support/helpers/usage_data_helpers.rb +++ b/spec/support/helpers/usage_data_helpers.rb @@ -78,6 +78,7 @@ module UsageDataHelpers labels lfs_objects merge_requests + merge_requests_users milestone_lists milestones notes @@ -117,12 +118,18 @@ module UsageDataHelpers projects_with_expiration_policy_enabled_with_cadence_set_to_14d projects_with_expiration_policy_enabled_with_cadence_set_to_1month projects_with_expiration_policy_enabled_with_cadence_set_to_3month + projects_with_terraform_reports + projects_with_terraform_states pages_domains protected_branches releases remote_mirrors snippets + personal_snippets + project_snippets suggestions + terraform_reports + terraform_states todos uploads web_hooks @@ -157,6 +164,11 @@ module UsageDataHelpers object_store ).freeze + def stub_usage_data_connections + allow(ActiveRecord::Base.connection).to receive(:transaction_open?).and_return(false) + allow(Gitlab::Prometheus::Internal).to receive(:prometheus_enabled?).and_return(false) + end + def stub_object_store_settings allow(Settings).to receive(:[]).with('artifacts') .and_return( @@ -209,4 +221,16 @@ module UsageDataHelpers 'proxy_download' => false } } ) end + + def expect_prometheus_api_to(*receive_matchers) + expect_next_instance_of(Gitlab::PrometheusClient) do |client| + receive_matchers.each { |m| expect(client).to m } + end + end + + def allow_prometheus_queries + allow_next_instance_of(Gitlab::PrometheusClient) do |client| + allow(client).to receive(:aggregate).and_return({}) + end + end end |