diff options
Diffstat (limited to 'spec/support/helpers/cycle_analytics_helpers.rb')
-rw-r--r-- | spec/support/helpers/cycle_analytics_helpers.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/spec/support/helpers/cycle_analytics_helpers.rb b/spec/support/helpers/cycle_analytics_helpers.rb index eba5771e062..0accb341cb9 100644 --- a/spec/support/helpers/cycle_analytics_helpers.rb +++ b/spec/support/helpers/cycle_analytics_helpers.rb @@ -91,13 +91,13 @@ module CycleAnalyticsHelpers wait_for_requests end - def create_value_stream_group_aggregation(group) - aggregation = Analytics::CycleAnalytics::Aggregation.safe_create_for_namespace(group) + def create_value_stream_aggregation(group_or_project_namespace) + aggregation = Analytics::CycleAnalytics::Aggregation.safe_create_for_namespace(group_or_project_namespace) Analytics::CycleAnalytics::AggregatorService.new(aggregation: aggregation).execute end def select_group_and_custom_value_stream(group, custom_value_stream_name) - create_value_stream_group_aggregation(group) + create_value_stream_aggregation(group) select_group(group) select_value_stream(custom_value_stream_name) @@ -235,4 +235,13 @@ module CycleAnalyticsHelpers pipeline: dummy_pipeline(project), protected: false) end + + def create_deployment(args) + project = args[:project] + environment = project.environments.production.first || create(:environment, :production, project: project) + create(:deployment, :success, args.merge(environment: environment)) + + # this is needed for the DORA API so we have aggregated data + ::Dora::DailyMetrics::RefreshWorker.new.perform(environment.id, Time.current.to_date.to_s) if Gitlab.ee? + end end |