def test_job_started_queued(self): run_name = 'test_job_started_queued' run = Run(run_name) job_id = '42' job = Job(dict(name=run_name, job_id=job_id, status='queued'), run) job.update(dict(status='running')) assert job.started is not None
def test_run_status_queued_to_running(self): run_name = "run_status_queued_to_running" new_run = Run(run_name) job = Job(dict(job_id=1, status='queued'), new_run) Job(dict(job_id=2, status='queued'), new_run) job.update(dict(status='running')) assert new_run.status == 'running'
def test_success_updates_status(self): run_name = 'test_success_updates_status' run = Run(run_name) job_id = '27' job = Job(dict(name=run_name, job_id=job_id, status='running'), run) models.commit() job.update(dict(success=True)) models.commit() assert job.status == 'pass'
def test_status_dead_ignored_when_success_true(self): run_name = 'test_status_dead_ignored_when_success_set' run = Run(run_name) job_id = '27' job = Job(dict(name=run_name, job_id=job_id, status='running'), run) models.commit() job.update(dict(success=True)) models.commit() job.update(dict(status='dead')) models.commit() assert job.status == 'pass'
def test_statsd_update(self, m_get_client): m_client = Mock() m_counter = Mock() m_client.get_counter.return_value = m_counter m_get_client.return_value = m_client run_name = 'test_statsd_update' run = Run(run_name) job_id = '27' job = Job(dict(name=run_name, job_id=job_id, status='running'), run) models.commit() job.update({'status': 'pass'}) models.commit() assert job.status == 'pass' assert m_get_client.called_once_with() assert m_client.get_counter.called_once_with('jobs.status') assert m_counter.increment.called_once_with('pass')