Avoid seasonal clock changes issues in specs #4208
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References
Background
Using
travel
we go toTime.now + interval
. If the application's time zone changes due to seasonal clock changes during that interval, we might travel to a time which is not the time we intended to travel to.Example:
On a system using the UTC time zone, it's 9AM on October 25 (Friday). Since by default CONSUL uses the Madrid time zone, it means the application's time is 11AM.
We use
travel
to advance three days. That means we go to 9AM UTC on October 28 (Monday). The application's time will be 10AM due to the seasonal clock change, so we haven't fully traveled three days in application's time.To reproduce locally, run:
Objectives
Using
travel_to
with3.days.from_now
, which uses the application's time zone and so it will travel to October 28 at 11AM, solves the problem.