Skip to content

Speed up the cycle_analytics model specs

Robert May requested to merge let-it-go into master

What does this MR do?

Drops a minute off the spec/models/cycle_analytics folder. There seemed to be a number of things that didn't actually make the specs fail if they were removed, and the rest of the speed improvements came from let_it_be.

As seen in create-stage#12604 (closed).

Totally accurate benchmarks

Original

Top 10 slowest examples (66.41 seconds, 39.6% of total time):
  CycleAnalytics#code with deployment start condition: issue mentioned in a commit end condition: merge request that closes issue is created finds the median of available d
urations between the two conditions
    9.22 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:32
  CycleAnalytics#plan start condition: issue associated with a milestone and list label added to issue end condition: issue mentioned in a commit finds the median of availa
ble durations between the two conditions
    7.33 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:32
  CycleAnalytics#plan start condition: list label added to issue end condition: issue mentioned in a commit finds the median of available durations between the two conditio
ns
    7.09 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:32
  CycleAnalytics#production start condition: issue is created end condition: merge request that closes issue is deployed to production and production deploy happens after merge request is merged (along with other changes) finds the median of available durations between the two conditions
    6.73 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:32
  CycleAnalytics#staging start condition: merge request that closes issue is merged end condition: merge request that closes issue is deployed to production and production deploy happens after merge request is merged (along with other changes) finds the median of available durations between the two conditions
    6.67 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:32
  CycleAnalytics#plan start condition: issue associated with a milestone end condition: issue mentioned in a commit finds the median of available durations between the two conditions
    6.13 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:32
  CycleAnalytics#staging start condition: merge request that closes issue is merged end condition: production deploy happens after merge request is merged (along with other changes) finds the median of available durations between the two conditions
    5.99 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:32
  CycleAnalytics#production start condition: issue is created end condition: merge request that closes issue is deployed to production finds the median of available durations between the two conditions
    5.83 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:32
  CycleAnalytics#code without deployment start condition: issue mentioned in a commit end condition: merge request that closes issue is created finds the median of available durations between the two conditions
    5.82 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:32
  CycleAnalytics#production start condition: issue is created end condition: production deploy happens after merge request is merged (along with other changes) finds the median of available durations between the two conditions
    5.58 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:32

Top 9 slowest example groups:
  CycleAnalytics#plan
    2.16 seconds average (36.72 seconds / 17 examples) ./spec/models/cycle_analytics/plan_spec.rb:5
  CycleAnalytics#code
    1.77 seconds average (24.74 seconds / 14 examples) ./spec/models/cycle_analytics/code_spec.rb:5
  CycleAnalytics#staging
    1.67 seconds average (30.13 seconds / 18 examples) ./spec/models/cycle_analytics/staging_spec.rb:5
  CycleAnalytics#issue
    1.49 seconds average (25.41 seconds / 17 examples) ./spec/models/cycle_analytics/issue_spec.rb:5
  CycleAnalytics#production
    1.31 seconds average (23.57 seconds / 18 examples) ./spec/models/cycle_analytics/production_spec.rb:5
  CycleAnalytics#test
    1.25 seconds average (12.52 seconds / 10 examples) ./spec/models/cycle_analytics/test_spec.rb:5
  CycleAnalytics::ProjectLevel
    1.16 seconds average (1.16 seconds / 1 example) ./spec/models/cycle_analytics/project_level_spec.rb:5
  CycleAnalytics#review
    1.05 seconds average (7.35 seconds / 7 examples) ./spec/models/cycle_analytics/review_spec.rb:5
  CycleAnalytics::GroupLevel
    0.79844 seconds average (2.4 seconds / 3 examples) ./spec/models/cycle_analytics/group_level_spec.rb:5

Finished in 2 minutes 47.5 seconds (files took 18.18 seconds to load)
105 examples, 0 failures

This branch

Top 10 slowest examples (55.36 seconds, 50.2% of total time):
  CycleAnalytics#staging start condition: merge request that closes issue is merged end condition: merge request that closes issue is deployed to production and production
deploy happens after merge request is merged (along with other changes) finds the median of available durations between the two conditions
    6.77 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:34
  CycleAnalytics#production start condition: issue is created end condition: merge request that closes issue is deployed to production and production deploy happens after m
erge request is merged (along with other changes) finds the median of available durations between the two conditions
    6.72 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:34
  CycleAnalytics#code with deployment start condition: issue mentioned in a commit end condition: merge request that closes issue is created finds the median of available d
urations between the two conditions
    6.43 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:34
  CycleAnalytics#production start condition: issue is created end condition: production deploy happens after merge request is merged (along with other changes) finds the me
dian of available durations between the two conditions
    5.85 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:34
  CycleAnalytics#production start condition: issue is created end condition: merge request that closes issue is deployed to production finds the median of available duratio
ns between the two conditions
    5.65 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:34
  CycleAnalytics#staging start condition: merge request that closes issue is merged end condition: production deploy happens after merge request is merged (along with other
 changes) finds the median of available durations between the two conditions
    5.42 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:34
  CycleAnalytics#staging start condition: merge request that closes issue is merged end condition: merge request that closes issue is deployed to production finds the media
n of available durations between the two conditions
    5.38 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:34
  CycleAnalytics#code without deployment start condition: issue mentioned in a commit end condition: merge request that closes issue is created finds the median of availabl
e durations between the two conditions
    4.84 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:34
  CycleAnalytics#review start condition: merge request that closes issue is created end condition: merge request that closes issue is merged finds the median of available d
urations between the two conditions
    4.34 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:34
  CycleAnalytics#test start condition: pipeline is started end condition: pipeline is finished finds the median of available durations between the two conditions
    3.96 seconds ./spec/support/cycle_analytics_helpers/test_generation.rb:34

Top 9 slowest example groups:
  CycleAnalytics#staging
    1.51 seconds average (27.14 seconds / 18 examples) ./spec/models/cycle_analytics/staging_spec.rb:5
  CycleAnalytics#code
    1.29 seconds average (18.12 seconds / 14 examples) ./spec/models/cycle_analytics/code_spec.rb:5
  CycleAnalytics#production
    1.19 seconds average (21.39 seconds / 18 examples) ./spec/models/cycle_analytics/production_spec.rb:5
  CycleAnalytics::ProjectLevel
    1.11 seconds average (1.11 seconds / 1 example) ./spec/models/cycle_analytics/project_level_spec.rb:5
  CycleAnalytics#test
    1.07 seconds average (10.74 seconds / 10 examples) ./spec/models/cycle_analytics/test_spec.rb:5
  CycleAnalytics#review
    1.02 seconds average (7.11 seconds / 7 examples) ./spec/models/cycle_analytics/review_spec.rb:5
  CycleAnalytics#plan
    0.78598 seconds average (13.36 seconds / 17 examples) ./spec/models/cycle_analytics/plan_spec.rb:5
  CycleAnalytics::GroupLevel
    0.77872 seconds average (2.34 seconds / 3 examples) ./spec/models/cycle_analytics/group_level_spec.rb:5
  CycleAnalytics#issue
    0.28381 seconds average (4.82 seconds / 17 examples) ./spec/models/cycle_analytics/issue_spec.rb:5

Finished in 1 minute 50.18 seconds (files took 17.33 seconds to load)
105 examples, 0 failures

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Michael Kozono

Merge request reports