Fix time period test that could result in a flake test within 15 days #527
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.
… of a DST change. The random_time function of the Faker::Time class works by rolling the clock forward a random number of hours until it's in the right period. For example, for afternoon the clock will be rolled forward 12 to 17 hours from midnight. However, when DST starts this will result in a time of 13:xx to 18:xx, because of the extra hour added by DST. The opposite effect happens when DST ends. On these days the random_time parameter thus has a chance to generate an off-by-one hour time. This bug seems too small to fix compared to the complexity of the fix. However, for 15 days before the end or start of DST (or 30 days per year), the test as currently written, will flake. This change eliminates the flake by fixing the dates used for the test as non-DST dates.