예제 #1
0
 def wait_pipeline_result(self, result: PipelineResult):
     if self.wait_until_finish and self.execution_timeout_sec:
         timeout_in_milliseconds = 1000 * (
             self.execution_timeout_sec -
             self.pipeline_level_execution_timeout_shift)
         result.wait_until_finish(timeout_in_milliseconds)
         if not PipelineState.is_terminal(result.state):
             result.cancel()
             raise RuntimeError(
                 f'Job {self.id} timed out ({self.execution_timeout_sec})')
예제 #2
0
    def test_pipeline_state_matcher_fails(self):
        """Test PipelineStateMatcher fails when using default expected state
    and job actually finished in CANCELLED/DRAINED/FAILED/STOPPED/UNKNOWN
    """
        failed_state = [
            PipelineState.CANCELLED, PipelineState.DRAINED,
            PipelineState.FAILED, PipelineState.STOPPED, PipelineState.UNKNOWN
        ]

        for state in failed_state:
            pipeline_result = PipelineResult(state)
            with self.assertRaises(AssertionError):
                hc_assert_that(pipeline_result,
                               verifiers.PipelineStateMatcher())
예제 #3
0
 def test_pipeline_state_matcher_given_state(self):
     """Test PipelineStateMatcher successes when matches given state"""
     pipeline_result = PipelineResult(PipelineState.FAILED)
     hc_assert_that(pipeline_result,
                    verifiers.PipelineStateMatcher(PipelineState.FAILED))
예제 #4
0
 def test_pipeline_state_matcher_success(self):
     """Test PipelineStateMatcher successes when using default expected state
 and job actually finished in DONE
 """
     pipeline_result = PipelineResult(PipelineState.DONE)
     hc_assert_that(pipeline_result, verifiers.PipelineStateMatcher())