Skip to content

Print expected and actual spec duration in job log

Jennifer Li requested to merge jennli-add-expected-duration into master

What does this MR do and why?

Adds the following job log to show example group duration and elapsed time after running each example group:

Example group RSpec::ExampleGroups::User took 3 minutes 14.71 seconds.

RSpec timer is at 100942.04477. RSpec elapsed time: 3 minutes 20.04 seconds.

...

Example group RSpec::ExampleGroups::Ability took 0 minutes 11.21 seconds.

RSpec timer is at 100953.257565. RSpec elapsed time: 3 minutes 31.26 seconds.

Screenshot_2023-11-29_at_3.42.17_PM

This will allow us to have access to run time information throughout job and have more troubleshooting data when a job times out.

The MR also parses the expected duration for the test suite as predicted by Knapsack. It will upload a new artifact file "knapsack/expected_duration_report.json" to list the expected run time for each test file. This way we can compare how well Knapsack was able to predict and distribute tests for this job.

Re: Proposal: Introduce a "job duration analysis" s... (gitlab-org/quality/engineering-productivity/team#323 - closed)

This can help set up troubleshooting trace for Create process to troubleshoot Knapsack scheduling (gitlab-org/quality/engineering-productivity/team#301 - closed)

How to verify

Run GITLAB_CI=true bundle exec rspec spec/models/user_spec.rb spec/models/ability_spec.rb

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jennifer Li

Merge request reports