mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 19:21:06 -03:30
5% performance boost on make test
Calling `.after` on a dateutil.rrule object that has an UNTIL clause performs very poorly if the interval is low and the start time is a long time ago. This patch replaces two test cases where we were using a minute interval with a fixed start time of (currently) 2 years ago, which resulted in aproximately 40s of execution time to simply evaluate `.after(now())`. Replacing these two tests with tests that start from "yesterday" while keeping the same INTERVAL and UNTIL settings eliminates this unnecessary slowdown while maintaining the spirit of the original tests.
This commit is contained in:
@@ -14,12 +14,13 @@ from awx.main.tests.base import BaseTest
|
||||
|
||||
__all__ = ['ScheduleTest']
|
||||
|
||||
UNTIL_SCHEDULE = "DTSTART:20140331T075000Z RRULE:FREQ=MINUTELY;INTERVAL=1;UNTIL=30230401T075000Z"
|
||||
YESTERDAY = (datetime.date.today() - datetime.timedelta(1)).strftime('%Y%m%dT075000Z')
|
||||
UNTIL_SCHEDULE = "DTSTART:%s RRULE:FREQ=MINUTELY;INTERVAL=1;UNTIL=30230401T075000Z" % YESTERDAY
|
||||
EXPIRED_SCHEDULES = ["DTSTART:19340331T055000Z RRULE:FREQ=MINUTELY;INTERVAL=10;COUNT=5"]
|
||||
INFINITE_SCHEDULES = ["DTSTART:30340331T055000Z RRULE:FREQ=MINUTELY;INTERVAL=10"]
|
||||
GOOD_SCHEDULES = ["DTSTART:20500331T055000Z RRULE:FREQ=MINUTELY;INTERVAL=10;COUNT=5",
|
||||
"DTSTART:20240331T075000Z RRULE:FREQ=DAILY;INTERVAL=1;COUNT=1",
|
||||
"DTSTART:20140331T075000Z RRULE:FREQ=MINUTELY;INTERVAL=1;UNTIL=20230401T075000Z",
|
||||
"DTSTART:%s RRULE:FREQ=MINUTELY;INTERVAL=1;UNTIL=20230401T075000Z" % YESTERDAY,
|
||||
"DTSTART:20140331T075000Z RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,FR",
|
||||
"DTSTART:20140331T075000Z RRULE:FREQ=WEEKLY;INTERVAL=5;BYDAY=MO",
|
||||
"DTSTART:20140331T075000Z RRULE:FREQ=MONTHLY;INTERVAL=1;BYMONTHDAY=6",
|
||||
|
||||
Reference in New Issue
Block a user