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

azkaban.trigger.BasicTimeCheckerTest#testPDTtoPSTdst1 only worked in 2020 #3083

Open
xandris opened this issue Apr 29, 2022 · 0 comments
Open

Comments

@xandris
Copy link

xandris commented Apr 29, 2022

Hi, this test cannot work as designed anymore. The idea is

  • have cron fire off on November 1st and 2nd at 1AM, 2020. The PST->PDT changeover happens, so there are two "1AMs"
  • it should fire off once on November 1st
  • it should fire off again on November 2nd

The problem is there's no way to force BasicTimeChecker to stop. It will try to find the earliest date that matches the cron expression in the future. Failing that, it will pick the newest date that matches.

So this test fails because BasicTimeChecker immediately picks the November 2nd execution date, skipping over November 1st. The test was updated March 10 of 2020, and it would have worked until November 1st at 1:01 AM.

You can dynamically sub in "this year", but the test will still fail after November 1st, 1:01AM.

Also the test doesn't actually test the two execution times since it doesn't advance the timer.

I'm not sure how to actually accomplish this check without forcing "current time" to be before November 1st. You can do that with Joda's DateTimeUtils, but the change is JVM wide. If the goal is to test BasicTimeChecker, maybe a method could be added to get the next time that matches the expression or period without attempting to find the first one after now. The while loop in calculateNextTime could use this new method.

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

No branches or pull requests

1 participant