Skip to content
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

Fix parsing begin time flag #268

Merged
merged 6 commits into from
Mar 22, 2024

Conversation

FluffyEscargot
Copy link
Contributor

@FluffyEscargot FluffyEscargot commented Feb 12, 2024

Closes #267

  • Parsing of start time failed, because regex produces 3 matching groups, not more

- Parsing of start time failed, because regex produces 3 matching groups, not more
- Replace UTC with local timezone when computing delay. This matches the expectation of the user
Copy link
Collaborator

@deitch deitch left a comment

Choose a reason for hiding this comment

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

  1. Can we split this into 2 changes? Based on the comment on the issue, the discussion around "how to fix date parsing which is broken" is distinct from the discussion around "how to support timezones".
  2. Can we include a test for this? We already have TestWaitForCron() which was the most important part to get right, given its complexities), so this should be easy enough to add. More importantly, it will help explain the use cases here.

@FluffyEscargot FluffyEscargot changed the title Fix parsing begin time flag, use local time Fix parsing begin time flag Feb 14, 2024
- refactor waitForBeginTime into new function to simplify testing
- write basic passing and failing tests
@FluffyEscargot
Copy link
Contributor Author

I've added the tests to cover basic cases, not looking at timezones yet.
What I haven't included yet, is some inputs which pass, even though they shouldn't in my opinion:

{"fail invalid time", "2401", "2018-10-10T10:00:00Z", time.Duration(0), fmt.Errorf("invalid format for begin delay '2401'")},
{"fail too long time", "12345", "2018-10-10T10:00:00Z", time.Duration(0), fmt.Errorf("invalid format for begin delay '12345'")},
  1. 2401, time.Date accepts values outside the usual range, so doesn't have to be <24 and <60 for hours and minutes
  2. 12345, the regex currently allows for leading or trailing characters, so aaaa2309bbbb also passes. Adding ^ and $ to begin and end of the regex would fix that

@deitch
Copy link
Collaborator

deitch commented Feb 14, 2024

I've added the tests to cover basic cases, not looking at timezones yet.

Thanks. Keeps it cleaner.

What I haven't included yet, is some inputs which pass, even though they shouldn't in my opinion:

So I should wait to kick off CI?

- change begin time regex to only allow 4 characters
- add test for regex
- add tests for time outside normal range
@FluffyEscargot
Copy link
Contributor Author

Ready to merge

deitch
deitch previously approved these changes Feb 25, 2024
@deitch
Copy link
Collaborator

deitch commented Feb 25, 2024

All looks good, but needs a rebase.

@deitch deitch merged commit cd18dd8 into databacker:master Mar 22, 2024
2 checks passed
@FluffyEscargot FluffyEscargot deleted the fix-parsing-begin-flag branch March 22, 2024 10:28
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.

Go version: parsing of begin time fails
2 participants