Skip to content

Fix flaky 'Query.runner(id)' spec

Pedro Pombeiro requested to merge pedropombeiro/473226/fix-flaky-test into master

What does this MR do and why?

This MR addresses the failureflaky-test described in #473226 (closed). The problem was that the let_it_be declarations were executed before the time was frozen, meaning that the comparisons were executed against a wrong reference timestamp. I've changed them to let! declarations and reduced the time delta used in the traits to make these cases more obvious.

In addition, I've spotted a minor bug in the Ci::Runner.recent query which was using >= for comparison with the dates, instead of >. The reason the respective spec wasn't failing is because time wasn't frozen there. By adding :freeze_time in the master branch and running the spec, one can see the failure which is then fixed by changing the comparison.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

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

n/a

How to set up and validate locally

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

n/a

Edited by Pedro Pombeiro

Merge request reports

Loading