File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
tests/pytests/functional/modules/state Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -2708,10 +2708,13 @@ def verify_retry_data(self, retry_data):
2708
2708
]
2709
2709
else :
2710
2710
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
2711
2714
else :
2712
2715
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"
2715
2718
)
2716
2719
validated_retry_data = retry_defaults
2717
2720
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):
710
710
assert state_return .full_return ["duration" ] >= 3
711
711
712
712
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
+
713
737
@pytest .mark .skip_initial_gh_actions_failure (skip = _check_skip )
714
738
def test_retry_option_success (state , state_tree , tmp_path ):
715
739
"""
You can’t perform that action at this time.
0 commit comments