Skip to content

Fix tests to avoid time zone dependent DateTime values#24323

Merged
AlekseyTs merged 1 commit intodotnet:dev15.6.xfrom
tlgkccampbell:master
Jan 21, 2018
Merged

Fix tests to avoid time zone dependent DateTime values#24323
AlekseyTs merged 1 commit intodotnet:dev15.6.xfrom
tlgkccampbell:master

Conversation

@tlgkccampbell
Copy link
Copy Markdown
Contributor

Ask Mode template completed

Customer scenario

Unable to successfully run compiler tests in Eastern time zone

Bugs this fixes

N/A

Workarounds, if any

N/A

Risk

N/A

Performance impact

N/A

Is this a regression from a previous update?

No

Root cause analysis

The tests in question were introduced in 7063899. An instance of DateTime is used as an example of a reference type in the tests for this fix, but the way in which those instances are constructed is time zone dependent; the DateTime.Parse() method always converts the date to DateTimeKind.Local, meaning that the actual value of Ticks will be different depending on where in the world the tests are run.

How was the bug found?

While in the Eastern time zone, I cloned Roslyn and tried to run the tests.

Test documentation updated?

N/A

@tlgkccampbell tlgkccampbell requested a review from a team as a code owner January 18, 2018 22:17
@dnfclas
Copy link
Copy Markdown

dnfclas commented Jan 18, 2018

CLA assistant check
All CLA requirements met.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DateTime.Parse(""2017-11-13T14:25:00Z"", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal) [](start = 44, length = 104)

Can we simply use DateTime(Int64) constructor that takes the original number of tiks (636461511000000000)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why not. If that's preferable, I can update the PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why not. If that's preferable, I can update the PR.

I think that would be preferable over making the unit-test dependent on Globalization APIs.

@AlekseyTs
Copy link
Copy Markdown
Contributor

Done with review pass (iteration 1).

@tlgkccampbell
Copy link
Copy Markdown
Contributor Author

tlgkccampbell commented Jan 19, 2018

Based on the console output, I'm a bit unclear on why the windows_release_vs-integration_prtest check failed; some kind of transient Jenkins error?

@tlgkccampbell
Copy link
Copy Markdown
Contributor Author

I've updated the PR to remove the dependency on the Globalization APIs, as requested.

Copy link
Copy Markdown
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AlekseyTs AlekseyTs changed the base branch from master to dev15.6.x January 20, 2018 17:30
@AlekseyTs AlekseyTs changed the base branch from dev15.6.x to master January 20, 2018 17:31
@AlekseyTs
Copy link
Copy Markdown
Contributor

@tlgkccampbell Please re-target this PR against dev15.6.x branch.

@tlgkccampbell tlgkccampbell changed the base branch from master to dev15.6.x January 20, 2018 17:38
@tlgkccampbell tlgkccampbell requested review from a team as code owners January 20, 2018 17:39
@tlgkccampbell
Copy link
Copy Markdown
Contributor Author

@AlekseyTs OK, I've re-targeted the PR.

@AlekseyTs AlekseyTs merged commit fbbe6c5 into dotnet:dev15.6.x Jan 21, 2018
@AlekseyTs
Copy link
Copy Markdown
Contributor

@tlgkccampbell Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants