summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-15 18:08:34 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-15 18:08:34 +0000
commit571d993b49313dd806bd3f6af16d36c26d9d28ca (patch)
tree06bd12c4b56b97881aef8a00d4d46698de1eb63f /spec/support
parent9044365a91112d426fbbfba07eca595652bbe2df (diff)
downloadgitlab-ce-571d993b49313dd806bd3f6af16d36c26d9d28ca.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/cycle_analytics_helpers/test_generation.rb2
-rw-r--r--spec/support/migrations_helpers/prometheus_service_helpers.rb35
2 files changed, 36 insertions, 1 deletions
diff --git a/spec/support/cycle_analytics_helpers/test_generation.rb b/spec/support/cycle_analytics_helpers/test_generation.rb
index 2fac6bfb30b..34018263339 100644
--- a/spec/support/cycle_analytics_helpers/test_generation.rb
+++ b/spec/support/cycle_analytics_helpers/test_generation.rb
@@ -117,7 +117,7 @@ module CycleAnalyticsHelpers
data = data_fn[self]
end_time = rand(1..10).days.from_now
- end_time_conditions.each_with_index do |(condition_name, condition_fn), index|
+ end_time_conditions.each_with_index do |(_condition_name, condition_fn), index|
Timecop.freeze(end_time + index.days) { condition_fn[self, data] }
end
diff --git a/spec/support/migrations_helpers/prometheus_service_helpers.rb b/spec/support/migrations_helpers/prometheus_service_helpers.rb
new file mode 100644
index 00000000000..88f2f71ee1e
--- /dev/null
+++ b/spec/support/migrations_helpers/prometheus_service_helpers.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+module MigrationHelpers
+ module PrometheusServiceHelpers
+ def service_params_for(project_id, params = {})
+ {
+ project_id: project_id,
+ active: false,
+ properties: '{}',
+ type: 'PrometheusService',
+ template: false,
+ push_events: true,
+ issues_events: true,
+ merge_requests_events: true,
+ tag_push_events: true,
+ note_events: true,
+ category: 'monitoring',
+ default: false,
+ wiki_page_events: true,
+ pipeline_events: true,
+ confidential_issues_events: true,
+ commit_events: true,
+ job_events: true,
+ confidential_note_events: true,
+ deployment_events: false
+ }.merge(params)
+ end
+
+ def row_attributes(entity)
+ entity.attributes.with_indifferent_access.tap do |hash|
+ hash.merge!(hash.slice(:created_at, :updated_at).transform_values { |v| v.to_s(:db) })
+ end
+ end
+ end
+end