def test_run_missing_ready_not_enabled(self): """run_missing_ready does nothing if the class isn't enabled.""" self.createMissingJob() with monitor_celery() as responses: with dbuser("run_missing_ready"): with TransactionFreeOperation.require(): self.RunMissingReady().run(_no_init=True) self.assertEqual([], responses)
def test_run_missing_ready_not_enabled(self): """run_missing_ready does nothing if the class isn't enabled.""" self.createMissingJob() with monitor_celery() as responses: with dbuser('run_missing_ready'): with TransactionFreeOperation.require(): self.RunMissingReady().run(_no_init=True) self.assertEqual([], responses)
def test_run_missing_ready(self): """run_missing_ready requests the job to run if not scheduled.""" self.createMissingJob() self.useFixture(FeatureFixture({"jobs.celery.enabled_classes": "BranchScanJob"})) with monitor_celery() as responses: with dbuser("run_missing_ready"): with TransactionFreeOperation.require(): self.RunMissingReady().run(_no_init=True) self.assertEqual(1, len(responses))
def test_run_missing_ready(self): """run_missing_ready requests the job to run if not scheduled.""" self.createMissingJob() self.useFixture( FeatureFixture({'jobs.celery.enabled_classes': 'BranchScanJob'})) with monitor_celery() as responses: with dbuser('run_missing_ready'): with TransactionFreeOperation.require(): self.RunMissingReady().run(_no_init=True) self.assertEqual(1, len(responses))
def test_without_rabbitmq(self): # If no RabbitMQ host is configured, the job is not run via Celery. self.pushConfig('rabbitmq', host='none') self.useFixture( FeatureFixture({'jobs.celery.enabled_classes': 'TestJob'})) with monitor_celery() as responses: job = TestJob() job.celeryRunOnCommit() job_id = job.job_id transaction.commit() self.assertEqual([], responses) store = IStore(Job) dbjob = store.find(Job, id=job_id)[0] self.assertEqual(JobStatus.WAITING, dbjob.status)