summaryrefslogtreecommitdiff
path: root/spec/support/helpers/usage_data_helpers.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/support/helpers/usage_data_helpers.rb
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/support/helpers/usage_data_helpers.rb')
-rw-r--r--spec/support/helpers/usage_data_helpers.rb24
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