Improve robustness in Dates/conversions test #49086
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.
In [1], this test was observed to fail, with a 1 second pause between the two Dates.now calls. In general, particularly on high-load CI systems, we cannot make assumptions that calls will complete within any particular amount of time. Instead, we should be asserting properties that should be universally true. This test wants to assert that Dates.now() and Dates.now(UTC) give the same answer if the TZ environment variable is set appropriately, but of course we can't guarantee that these calls run at the same time. Rather than setting an arbitrary limit of 1 second, just run
Dates.now
again. Our semantics guarantee ordering of these calls (in the absence of leap days/seconds at least), so the test is more robust.[1] https://buildkite.com/julialang/julia-master/builds/22064#0186ff11-f07e-4ba4-9b54-21bdf738d35e