Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-09-07 08:55:01 +0300
committerTimothy Andrew <mail@timothyandrew.net>2016-09-07 09:42:51 +0300
commitdd112ef1174b2b0207769a361cddfc44dfe2e6d0 (patch)
treecc78741339cbfcb938c5da892d5c09db0587fe7e /app/models/cycle_analytics
parent0f44c5a56fdc5986797808c508d7b42236cee450 (diff)
Test the `staging` cycle analytics phase.
Remove overlap from the "start + end" durations in the happy test case. For the `staging` phase, the end time is the _first_ deployment that happens after the MR merge. If we have 5 MRs where the `start_time`s (merge time) are the same, and all the `end_time`s (deploy to production) a few days from now, only the earliest deploy will get picked up, because that consitutes a deploy for _all_ the MRs. We fix this by removing overlap. Every `start_time` is now generated to be _after_ the preceding `end_time`.
Diffstat (limited to 'app/models/cycle_analytics')
-rw-r--r--app/models/cycle_analytics/queries.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/cycle_analytics/queries.rb b/app/models/cycle_analytics/queries.rb
index 7816c96a0ed..2d134a0d9a4 100644
--- a/app/models/cycle_analytics/queries.rb
+++ b/app/models/cycle_analytics/queries.rb
@@ -85,6 +85,8 @@ class CycleAnalytics
lambda do |data_point|
merge_request = data_point[:merge_request]
if merge_request.metrics.present?
+ # The first production deploy to the target branch that occurs after the merge request has been merged in.
+ # TODO: Does this need to account for reverts?
deployments = Deployment.joins(:environment).where(ref: merge_request.target_branch, "environments.name" => "production").
where("deployments.created_at > ?", merge_request.metrics.merged_at)
deployment = deployments.order(:created_at).first