File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed
tests/pytests/functional/modules/state Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 1+ support retry: True as per docs
Original file line number Diff line number Diff line change @@ -2731,10 +2731,13 @@ def verify_retry_data(self, retry_data):
27312731 ]
27322732 else :
27332733 validated_retry_data [expected_key ] = retry_defaults [expected_key ]
2734+
2735+ elif isinstance (retry_data , bool ) and retry_data :
2736+ validated_retry_data = retry_defaults
27342737 else :
27352738 log .warning (
2736- "State is set to retry, but a valid dict for retry "
2737- "configuration was not found. Using retry defaults"
2739+ "State is set to retry, but retry: True or a valid dict for "
2740+ "retry configuration was not found. Using retry defaults"
27382741 )
27392742 validated_retry_data = retry_defaults
27402743 return validated_retry_data
Original file line number Diff line number Diff line change @@ -711,6 +711,30 @@ def test_retry_option(state, state_tree):
711711 assert state_return .full_return ["duration" ] >= 3
712712
713713
714+ def test_retry_option_is_true (state , state_tree ):
715+ """
716+ test the retry: True on a simple state with defaults
717+ ensure comment is as expected
718+ ensure state duration is greater than configured the passed (interval * attempts)
719+ """
720+ sls_contents = """
721+ file_test:
722+ file.exists:
723+ - name: /path/to/a/non-existent/file.txt
724+ - retry: True
725+ """
726+ expected_comment = (
727+ 'Attempt 1: Returned a result of "False", with the following '
728+ 'comment: "Specified path /path/to/a/non-existent/file.txt does not exist"'
729+ )
730+ with pytest .helpers .temp_file ("retry.sls" , sls_contents , state_tree ):
731+ ret = state .sls ("retry" )
732+ for state_return in ret :
733+ assert state_return .result is False
734+ assert expected_comment in state_return .comment
735+ assert state_return .full_return ["duration" ] >= 3
736+
737+
714738@pytest .mark .skip_initial_gh_actions_failure (skip = _check_skip )
715739def test_retry_option_success (state , state_tree , tmp_path ):
716740 """
You can’t perform that action at this time.
0 commit comments