toptal / chewy

High-level Elasticsearch Ruby framework based on the official elasticsearch-ruby client
MIT License
1.88k stars 364 forks source link

Fix intermittent time-based failure in delayed sidekiq spec #947

Closed mjankowski closed 4 months ago

mjankowski commented 4 months ago

This example was previously failing when it was run at exactly an "even" 10 second increment time. For example, it would fail at "12:00:10", but pass at "12:00:09" and "12:00:11". This leads to intermittent failures on CI (presumably around ~10% of runs).

Updated to use a helper method in the spec which more closely mirrors the scheduler code.

I noticed this during the CI runs from the previous PR ... and was able to verify this pattern by setting a specific time target for the Timecop.freeze line, which confirmed the pattern of fail/pass.

konalegi commented 4 months ago

It seems to be working, with no failure :wohoo: Could you please add the change log info? for instance like this https://github.com/toptal/chewy/pull/933/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR9

konalegi commented 4 months ago

I'll trigger CI 4-5 times to make sure nothing fails, and once you add changelog I'll release it :)

mjankowski commented 4 months ago

Added changelog commit here as well.

I see there may be a DIFFERENT intermittent failure in some of these CI runs (in rake helper spec), but it looks like none so far in the sidekiq one.

konalegi commented 4 months ago

Yeah, it's different, related to sidekiq, seems to be not failing