-
Notifications
You must be signed in to change notification settings - Fork 348
Add some tests for iso8601 parsing #3846
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
Open
waltdisgrace
wants to merge
1
commit into
ClusterLabs:main
Choose a base branch
from
waltdisgrace:new188
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+12
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
@waltdisgrace Tests are failing because of this:
The difference between those two numbers is 3600 seconds, which is one hour, which is way too round a number to be a coincidence. When I run it here, I get the same number as CI does. How did you generate the new test output? Do you perhaps have your timezone set to something unusual?
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.
We recently switched to daylight saving time. I would not be surprised if that's playing a role somehow. For example, if the system's timezone has an effect and if one of you has your system set to UTC and the other has your system set to local time.
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 don't think system time zone is supposed to play a role here though? Maybe there's some sort of rounding behavior that's implementation-dependent and differs on your two machines?
Uh oh!
There was an error while loading. Please reload this page.
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.
Besides, shouldn't the resulting time be 2h20m later in the second test? (or earlier maybe)
Uh oh!
There was an error while loading. Please reload this page.
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's a bug in our parsing. The time zone is parsed only if there's a space before the
+
or-
sign. (Note that my machine is on PDT: UTC-0700.)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.
@waltdisgrace Yeah, looks like our parsing code is wrong. If you're curious, you can get a free version of the ISO8601 standard here:
https://www.loc.gov/standards/datetime/iso-tc154-wg5_n0038_iso_wd_8601-1_2016-02-16.pdf
Section 3.4.1 is pretty explicit that spaces aren't allowed in the time strings, and section 4.2.5.2 restates that again for the time offset portion. So, the fact that we do not parse the timezone if there's a space means we're not handling the standard correctly.
This might be more than you were looking to get into, but it would be worth taking a look and seeing if you could fix that bug. Of course, nothing is easy and we'll need to support our buggy behavior for now as well.
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.
The fact that we don't parse the timezone UNLESS there's a space means we're not handling the standard correctly.
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.
Right, yes. That's what I meant to say. One day I'll learn to stop typing comments and talking in slack and talking in irc at the same time.