Refactoring cron to separate out test run function from real execution