-
Notifications
You must be signed in to change notification settings - Fork 899
Refactor the Reflog entries datetime comparisons #999
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
Conversation
Definitely 👍 I've been seeing such test failures in the past and it happened again with @sitereactor's latest build. |
This little bugger failed one too many builds. Throwing some code at it. |
{ | ||
public static DateTimeOffset TruncateMilliseconds(this DateTimeOffset dto) | ||
{ | ||
// From http://stackoverflow.com/a/1005222/335418 |
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.
/cc @martinwoodward
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.
/cc @ethomson
👍 |
I almost wonder if we should capture |
@dahlbyk I thought about that, but there are tests that actually perform multiple operations, each of them generating a reflog entry, with a potential different lower boundary. For this kind of cases, we'd need some kind of call to reinitialize what We may end up with some tests having no time related variables at all, magically asserting durations and some others with a strange call to I agree that this adds a ton of noise, but my main goal for this PR was to avoid restarting failed builds because of the way it was previously implemented. Long story short, I'm very far from being against this proposal, but I'm miserably falling short at imagining a code piece that would make sense. Any ideas? /cc @jamill |
A small objection, let's |
Refactor the Reflog entries datetime comparisons
|
We actually rely on
Assert.InRange
for this and usually ensure the entry has been created within the range of[DateTimeOffset.Now - 5 seconds, DateTimeOffset.Now]
.A better alternative (courtesy of @jamill), would be to retrieve the DateTimeOffset.Now before the action generating the reflog entry and ensuring the logged datetime uses this as the lower bound (ie.
recordedOffset, DateTimeOffset.Now]
).