-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Libraries] Fix TimeZoneInfoTests IsIanaIdTest for iOS/MacCatalyst/tvOS #58562
[Libraries] Fix TimeZoneInfoTests IsIanaIdTest for iOS/MacCatalyst/tvOS #58562
Conversation
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
@@ -2664,7 +2664,7 @@ public static void IsIanaIdTest() | |||
{ | |||
bool expected = !s_isWindows; | |||
|
|||
Assert.Equal((expected || TimeZoneInfo.Local.Id.Equals("Utc", StringComparison.OrdinalIgnoreCase)), TimeZoneInfo.Local.HasIanaId); | |||
Assert.Equal((expected || PlatformDetection.IsiOS || PlatformDetection.IstvOS || TimeZoneInfo.Local.Id.Equals("Utc", StringComparison.OrdinalIgnoreCase)), TimeZoneInfo.Local.HasIanaId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't make sense to me. I'd assume that !s_isWindows
is true
thus expected == true
and this condition would not need the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah oops, I got the order wrong when I checked the failure
It should still have |
The behavior of string timeZoneIdNotIANAId = PlatformDetection.IsiOS || PlatformDetection.IstvOS ? "America/Buenos_Aires" : "Pacific Standard Time";
Assert.False(TimeZoneInfo.FindSystemTimeZoneById(timeZoneIdNotIANAId).HasIanaId, $" should not be IANA Id.");
Assert.True(TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles").HasIanaId, $"'America/Los_Angeles' should be IANA Id"); Why Some more explanation would help here. |
Ah I think I know what happened. In #57732, the test failed because it would throw when looking up the timezone To maintain the purpose of the test check, I had evaluated all the timezones At the time, I wasn't aware that they are all considered Iana Ids (I didn't find the right documentation that compelled me to think that there was a bug when some of these returned false. As a result, I chose the first To my other mistake, I didn't make a clean build with recent main, and so my test failure was on Are there any TimeZoneIds that are found on iOS/MacCatalyst/tvOS that are not Iana Id? I believe any timezone that are not found will throw a timezonenotfound exception. Instead, I could perhaps tweak that part of the test that would |
There should not be any. On desktop there's a translation table between IANA IDs and Windows IDs (provided through libicu), so creating |
You can always refer to IANA timezones and can download the data and look at it. The data are just a text files. Or you can look at NodaTime page for quick reference. |
} | ||
else | ||
{ | ||
Assert.Throws<TimeZoneNotFoundException>(() => TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time").HasIanaId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking similarly since it is unnecessary, but was wondering if keeping the HasIanaId
would be in the spirit of the test purpose of checking if it was Iana Id.
The test is conditioned on It is actually patching a test that should not run in the first place. |
It can be changed to be false on iOS/MacCatalyst/tvOS. That would help remove a bunch of the manual |
The test (before your changes in this PR) was actually testing the implicit conversion when Windows name is passed on Unix platform. It would make more sense to me to just disable the whole set since it's actually identical situation to |
…ile from iana conversion support
I am preferring to test the throwing on iOS/tvOS as originally written. The reason is in the future if this functionality started to work on such platforms, we can get the test failures and can update the test by then. My comment shouldn't block this PR if you don't want considering it now. |
I can submit a PR with a separate test for that... but it makes sense to keep the browser and iOS test situation consistent because at the moment the implementation is identical. |
…OS (dotnet#58562) * [Libraries] Fix TimeZoneInfoTests IsIanaIdTest for iOS/MacCatalyst/tvOS * [Libraries] Fix IsIanaIdTest to assert throw for iOS/MacCatalyst/tvOS * Readd new line * [Mobile][Libraries] System.Runtime.Tests TimeZoneInfoTests remove mobile from iana conversion support * [libraries] System.Runtime.Tests revert IsIanaIdTest iOS tvOS special casing * Remove active issue added in recently merged PR Co-authored-by: Mitchell Hwang <[email protected]>
…t and test fixes for Android (#58841) Manual backport of #57208, #58519, #58562, #58210, #57732, #58428, #58586, #58745, #57687 to release/6.0 Numerous test suites have been failing for iOS/tvOS/MacCatalyst consistently on CI without useful logs as to why. Moreover, some of these suites pass locally. This PR looks to reduce the failures on CI by skipping the problematic suites Skips test suites logged in #53624 ActiveIssues #58440 #58418 #58367 #58584 Co-authored-by: Mitchell Hwang <[email protected]> Co-authored-by: Alexander Köplinger <[email protected]> Co-authored-by: Jo Shields <[email protected]>
Fixes #58440
On iOS/MacCatalyst/tvOS there are currently no time zones found that are not Iana Ids. As such, the original change to
IsIanaIdTest
in #57732 was incorrect.Browser, iOS, MacCatalyst, and tvOS all do not support Iana name conversions as a result of some ICU changes. For the tests, we opt to align Android along with iOS/MacCatalyst/tvOS for ICU support.
This PR does the following:
remove mobile from
SupportIanaNamesConversion
revert some changes from #57732