-
Notifications
You must be signed in to change notification settings - Fork 151
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
Use Utc times for integration tests #644
Conversation
@@ -31,7 +31,7 @@ public void TestStreamCreate() | |||
{ | |||
Context.RunInJsServer(c => | |||
{ | |||
DateTime now = DateTime.Now; | |||
DateTime now = DateTime.UtcNow; |
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.
Now that you pointed this out I think it would be better to change the assertion on line 45 to normalize the data before comparison.
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.
As a rule of thumb, it is best to work in UTC everywhere in the code until the point it needs to be displayed/logged. This way you avoid any confusion and potential errors due to winter/summer times.
I'll see what I can do for this commit
@@ -81,7 +81,7 @@ public void TestStreamCreate() | |||
public void TestStreamCreateWithNoSubject() { | |||
Context.RunInJsServer(c => | |||
{ | |||
DateTime now = DateTime.Now; | |||
DateTime now = DateTime.UtcNow; |
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.
Same comment on comparison line 94
@@ -639,7 +639,7 @@ public void TestGetStreams() | |||
MsgHeader h = new MsgHeader(); | |||
h.Add("foo", "bar"); | |||
|
|||
DateTime beforeCreated = DateTime.Now; | |||
DateTime beforeCreated = DateTime.UtcNow; //MessageInfo.Time is in UTC |
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.
fix the comparison line 652, 660
@LaurensVergote Thanks for this. Can you please sign your commits. https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits |
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.
LGTM
Admin merge - signing was added on most recent commits. |
Noticed a few of the integration tests failed when ran locally and decided to fix them.
The issue was that local timestamps were being compared with utc timestamps.
In .NET the DateTimeKind is not checked when comparing, so we must make sure these are the same.