Fix CI failures for roundtripEncoding() #1453
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.
roundtripEncoding()is failing sporadically in CI due to how Calendars are encoded. When encoding/decoding a Calendar, if the encoded calendar is equal toCalendar.currentat encode time, it will decode as whatever theCalendar.currentis at decode time, even if different from the originally encoded calendar. This means that if the system is set to the GMT TimeZone (so this test'scalendaris equal toCalendar.current) and another test changes the current calendar/locale between the encode call and the decode call, the decoded calendar (and recurrence rule) will compare inequality to the originally encoded value. Even though this is a FoundationEssentials test, this is possible because SwiftPM links and runs all test targets together into the same executable (unlike Xcode, where this issue does not reproduce as FoundationEssentials tests don't load FoundationInternationalization / don't parallelize with FoundationInternationalizationTests)For now, until we can determine the long term expectation for this behavior, simply ensure that the current internationalization preferences can't be mutated while this test is running by moving it to the internationalization suite and using our helper function.