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 @@ -2708,10 +2708,13 @@ def verify_retry_data(self, retry_data):
27082708 ]
27092709 else :
27102710 validated_retry_data [expected_key ] = retry_defaults [expected_key ]
2711+
2712+ elif isinstance (retry_data , bool ) and retry_data :
2713+ validated_retry_data = retry_defaults
27112714 else :
27122715 log .warning (
2713- "State is set to retry, but a valid dict for retry "
2714- "configuration was not found. Using retry defaults"
2716+ "State is set to retry, but retry: True or a valid dict for "
2717+ "retry configuration was not found. Using retry defaults"
27152718 )
27162719 validated_retry_data = retry_defaults
27172720 return validated_retry_data
Original file line number Diff line number Diff line change @@ -710,6 +710,30 @@ def test_retry_option(state, state_tree):
710710 assert state_return .full_return ["duration" ] >= 3
711711
712712
713+ def test_retry_option_is_true (state , state_tree ):
714+ """
715+ test the retry: True on a simple state with defaults
716+ ensure comment is as expected
717+ ensure state duration is greater than configured the passed (interval * attempts)
718+ """
719+ sls_contents = """
720+ file_test:
721+ file.exists:
722+ - name: /path/to/a/non-existent/file.txt
723+ - retry: True
724+ """
725+ expected_comment = (
726+ 'Attempt 1: Returned a result of "False", with the following '
727+ 'comment: "Specified path /path/to/a/non-existent/file.txt does not exist"'
728+ )
729+ with pytest .helpers .temp_file ("retry.sls" , sls_contents , state_tree ):
730+ ret = state .sls ("retry" )
731+ for state_return in ret :
732+ assert state_return .result is False
733+ assert expected_comment in state_return .comment
734+ assert state_return .full_return ["duration" ] >= 3
735+
736+
713737@pytest .mark .skip_initial_gh_actions_failure (skip = _check_skip )
714738def test_retry_option_success (state , state_tree , tmp_path ):
715739 """
You can’t perform that action at this time.
0 commit comments