@@ -2695,7 +2695,7 @@ def mock_upload_to_remote(process_log, ti):
26952695
26962696
26972697class TestSignalRetryLogic :
2698- """Test signal based retry logic in ActivitySubprocess."""
2698+ """Test retry logic for exit codes (signals and non-signal failures) in ActivitySubprocess."""
26992699
27002700 @pytest .mark .parametrize (
27012701 "signal" ,
@@ -2748,8 +2748,8 @@ def test_signals_without_retry_always_fail(self, mocker, signal):
27482748 result = mock_watched_subprocess .final_state
27492749 assert result == TaskInstanceState .FAILED
27502750
2751- def test_non_signal_exit_code_goes_to_failed (self , mocker ):
2752- """Test that non signal exit codes go to failed regardless of task retries ."""
2751+ def test_non_signal_exit_code_with_retry_goes_to_up_for_retry (self , mocker ):
2752+ """Test that non- signal exit codes with retries enabled go to UP_FOR_RETRY ."""
27532753 mock_watched_subprocess = ActivitySubprocess (
27542754 process_log = mocker .MagicMock (),
27552755 id = TI_ID ,
@@ -2761,6 +2761,21 @@ def test_non_signal_exit_code_goes_to_failed(self, mocker):
27612761 mock_watched_subprocess ._exit_code = 1
27622762 mock_watched_subprocess ._should_retry = True
27632763
2764+ assert mock_watched_subprocess .final_state == TaskInstanceState .UP_FOR_RETRY
2765+
2766+ def test_non_signal_exit_code_without_retry_goes_to_failed (self , mocker ):
2767+ """Test that non-signal exit codes without retries enabled go to FAILED."""
2768+ mock_watched_subprocess = ActivitySubprocess (
2769+ process_log = mocker .MagicMock (),
2770+ id = TI_ID ,
2771+ pid = 12345 ,
2772+ stdin = mocker .Mock (),
2773+ process = mocker .Mock (),
2774+ client = mocker .Mock (),
2775+ )
2776+ mock_watched_subprocess ._exit_code = 1
2777+ mock_watched_subprocess ._should_retry = False
2778+
27642779 assert mock_watched_subprocess .final_state == TaskInstanceState .FAILED
27652780
27662781
0 commit comments