Skip to content

Stub Gitlab::JobWaiter#wait for tests

Igor Drozdov requested to merge id-stub-waitable-worker into master

What does this MR do?

If WaitableWorker receives arglist with a number of elements more than 3 and less than 100, the wait method is called, which stops the execution for 10 seconds: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/workers/concerns/waitable_worker.rb#L26

We can disable it for tests in order to optimize runtime of tests. Here is the list of the files which call wait method and how many times it's called:

Screen_Shot_2020-09-18_at_11.13.16_PM

If we exclude 4 calls for spec/lib/gitlab/job_waiter_spec.rb which controls the duration of the timeout, we have 24 calls. If we stub the calls, we'll win 4 minutes of tests runtime and prevent from introducing future delays.

Edited by Igor Drozdov

Merge request reports