Skip to content

Include context in spec time tracking

Albert requested to merge alberts-knapsack-track-context into master

What does this MR do?

Track test time spend in before/after in knapsack so that knapsack execution time per file is closer to the actual rspec duration.

In the comparison below, we can see that knapsack global execution time is closer to the total rspec duration.

Before: https://gitlab.com/gitlab-org/gitlab/-/jobs/1165636482#L9069

  "spec/models/user_spec.rb": 86.19563937187195,
  "spec/services/ci/register_job_service_spec.rb": 46.63532996177673,
  "spec/services/ci/create_downstream_pipeline_service_spec.rb": 34.43165564537048,
  "spec/policies/issue_policy_spec.rb": 26.279865503311157,
...
Knapsack global time execution for tests: 10m 24s
Finished in 14 minutes 12 seconds (files took 50.27 seconds to load)

After: https://gitlab.com/gitlab-org/gitlab/-/jobs/1165733781#L9067

  "spec/models/user_spec.rb": 119.9533200263977,
  "spec/services/ci/register_job_service_spec.rb": 59.751078605651855,
  "spec/services/ci/create_downstream_pipeline_service_spec.rb": 44.74184823036194,
  "spec/policies/issue_policy_spec.rb": 32.7114417552948,
...
Knapsack global time execution for tests: 17m 34s
Finished in 17 minutes 37 seconds (files took 1 minute 3.05 seconds to load)

Rleated to #327087 (closed)

Screenshots (strongly suggested)

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 Heinrich Lee Yu

Merge request reports

Loading