databacker / mysql-backup

image to enable automated backups of mysql databases in containers
636 stars 178 forks source link

Fix parsing begin time flag #268

Closed FluffyEscargot closed 5 months ago

FluffyEscargot commented 7 months ago

Closes #267

FluffyEscargot commented 7 months ago

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 commented 7 months ago

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?

FluffyEscargot commented 6 months ago

Ready to merge

deitch commented 6 months ago

All looks good, but needs a rebase.