def test_cleanup_on_failure(self): config = BASIC_CONFIG + dedent(""" jobs: - name: "failjob" node: local schedule: "constant" actions: - name: "failaction" command: "failplz" """) + TOUCH_CLEANUP_FMT self.start_with_config(config) action_run_url = self.client.get_url('MASTER.failjob.0.failaction') sandbox.wait_on_state( self.client.action_runs, action_run_url, actionrun.ActionRun.FAILED, ) action_run_url = self.client.get_url('MASTER.failjob.1.cleanup') sandbox.wait_on_state( self.client.action_runs, action_run_url, actionrun.ActionRun.SUCCEEDED, ) job_runs = self.client.job( self.client.get_url('MASTER.failjob'), )['runs'] assert_gt(len(job_runs), 1)
def test_cleanup_on_failure(self): config = BASIC_CONFIG + dedent( """ jobs: - name: "failjob" node: local schedule: "constant" actions: - name: "failaction" command: "failplz" """ ) + TOUCH_CLEANUP_FMT self.start_with_config(config) action_run_url = self.client.get_url('MASTER.failjob.0.failaction') sandbox.wait_on_state( self.client.action_runs, action_run_url, actionrun.ActionRun.FAILED, ) action_run_url = self.client.get_url('MASTER.failjob.1.cleanup') sandbox.wait_on_state( self.client.action_runs, action_run_url, actionrun.ActionRun.SUCCEEDED, ) job_runs = self.client.job(self.client.get_url('MASTER.failjob'), )['runs'] assert_gt(len(job_runs), 1)
def test_monthly(self): sch = scheduler_from_config('1st day') next_run_date = sch.next_run_time(None) assert_gt(next_run_date, self.now) assert_equal(next_run_date.month, 7)
def _assert_range(self, x, lower, upper): assert_gt(x, lower) assert_lt(x, upper)