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 skip logic yearly period bug #869

Open
wants to merge 2 commits into
base: releasing-2.5
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test to prove bug and verify
  • Loading branch information
rrusso2007 authored Jan 19, 2018
commit 71b4590e59c6b0af44350537b8f6fe599a759866
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ class JobUtilsSpec extends SpecificationWithJUnit with Mockito {
scheduledTime.dayOfMonth().get must_== 1
}

"Can skip forward a job with a yearly period" in {
val schedule = s"R/2012-01-01T00:00:01.000Z/P1Y"
val job = new ScheduleBasedJob(schedule, "sample-name", "sample-command")
val now = new DateTime()

// Get the schedule stream, which should have been skipped forward
val stream = JobUtils.skipForward(job, now)
val scheduledTime = Iso8601Expressions.parse(stream.get.schedule, job.scheduleTimeZone).get._2

// Ensure that this job runs on the first of next month
scheduledTime.isAfter(now) must beTrue
scheduledTime.dayOfMonth().get must_== 1
}

"Can get job with arguments" in {
val schedule = "R/2012-01-01T00:00:01.000Z/P1M"
val arguments = "--help"
Expand Down