Skip to content

[EE] Greatly reduce test duration for git_access_spec

Robert Speicher requested to merge rs-git-access-spec-speed-ee into master

EE version of https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13675

This spec is slow -- 20+ minutes on CI. Numbers below are local.

Baseline

    Factory usage counts:
      name               total   avg   count
      project-repository 121.871 0.116 1049
      user               78.694  0.031 2569
      merge_request      60.41   0.135 448
      namespace          40.125  0.038 1065
      protected_branch   3.396   0.008 432
      group              2.442   0.013 192

Finished in 12 minutes 10 seconds (files took 15.44 seconds to load)
1067 examples, 0 failures

Post cherry-pick of https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13675

    Factory usage counts:
      name               total  avg   count
      project-repository 36.574 0.108 338
      merge_request      22.779 0.136 168
      user               20.53  0.028 746
      namespace          12.03  0.034 354
      group              2.455  0.013 192
      deploy_key         1.825  0.13  14
      protected_branch   1.608  0.007 222

Finished in 3 minutes 51.1 seconds (files took 14.22 seconds to load)
356 examples, 0 failures

Refactor run_group_permission_checks

This uses the same thinking as the earlier run_permission_checks refactor, to run all of the checks for the matrix in a single it block to avoid repeated setup.

    Factory usage counts:
      name               total  avg   count
      project-repository 19.041 0.112 170
      user               8.969  0.03  298
      merge_request      7.754  0.138 56
      namespace          6.641  0.036 186

Finished in 1 minute 44.65 seconds (files took 0.91818 seconds to load)
188 examples, 0 failures

🎉

Fix invalid GitAccess specs for License and secondary Geo node

Due to a logic error, these specs weren't actually doing anything -- we were running the checks on Hash.new(Hash.new(false)), which is just {}.

Refactor push_rule_check GitAccess specs

  • Reduces duplication of long ref strings
  • Passes push rule attributes directly to create_push_rule, rather than creating one and then updating it.
Edited by Robert Speicher

Merge request reports