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

Do not fast forward rrule if count is set #15696

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions awx/main/models/schedules.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def _fast_forward_rrule(rrule, ref_dt=None):
if rrule._freq not in {dateutil.rrule.HOURLY, dateutil.rrule.MINUTELY}:
return rrule

if rrule._count:
return rrule

if ref_dt is None:
ref_dt = now()

Expand Down
6 changes: 6 additions & 0 deletions awx/main/tests/unit/utils/test_schedule_fast_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@
assert new_rrule == rrule


def test_rrule_with_count_does_not_fast_forward():
rrule = dateutil.rrule.rrule(freq=MINUTELY, interval=5, count=1, dtstart=REF_DT)

Check warning on line 119 in awx/main/tests/unit/utils/test_schedule_fast_forward.py

View check run for this annotation

Codecov / codecov/patch

awx/main/tests/unit/utils/test_schedule_fast_forward.py#L119

Added line #L119 was not covered by tests

assert rrule == _fast_forward_rrule(rrule, ref_dt=REF_DT)

Check warning on line 121 in awx/main/tests/unit/utils/test_schedule_fast_forward.py

View check run for this annotation

Codecov / codecov/patch

awx/main/tests/unit/utils/test_schedule_fast_forward.py#L121

Added line #L121 was not covered by tests


@pytest.mark.parametrize(
('freq', 'interval'),
[
Expand Down
Loading