I would like to write a integration test were I can verify that a job gets automatically retried when it’s failing. Recently, I am wondering how I can setup a test in such way the scheduler is actually working? Can I somehow get informed whether the job I Enqueued actually got processed?
Currently, I am having the below code for the test but it’s not working for me:
var jobStorage = new MemoryStorage();
var options = new BackgroundJobServerOptions();
GlobalConfiguration.Configuration.UseStorage(jobStorage);
// Start
var scheduler = new BackgroundJobServer(options);
// add my custom AutomaticRetry job filter instance to global job filters collection
ApplySchedulerConfiguration();
BackgroundJob.Enqueue<JobTask>(task => task.ExecuteJob(123456, null));
// Stop
scheduler.Dispose();
Only how can I verify that a job got rescheduled multiple times to ensure the automatic retry is working and is enabled in our project?