Answer the question
In order to leave comments, you need to log in
How to test cron tasks in Docker? (how to speed up time)?
There is a Python (Flask + Celery mysql, redis) project.
Tasks are set for celery, which must be completed according to the schedule.
It is necessary to check that after N hours, or at the moment of time transition (or other problems and situations that may arise) are processed correctly.
Waiting a day/week/year for this is naturally not an option.
Changing the time in docker is not available.
How to solve this problem? (correct or fast)
Answer the question
In order to leave comments, you need to log in
Do you want to test Cron? That he will start at exactly the right time? Or do you still want to test the operation of a scheduled task?
Cron, I think, does not need testing. But the task can be covered with tests. And don't do magic.
Make a trigger for every 5 minutes and check that the job is working, then change the scheduling to the correct one.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question