Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix for unspecified retries on until + test (#16963)
fixes #16907
- Loading branch information
1 parent
bced871
commit 746ea64
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
- shell: python -c "import tempfile; print(tempfile.mkstemp()[1])" | ||
register: tempfilepath | ||
|
||
- set_fact: | ||
until_tempfile_path: "{{ tempfilepath.stdout }}" | ||
|
||
- name: loop with default retries | ||
shell: echo "run" >> {{ until_tempfile_path }} && wc -w < {{ until_tempfile_path }} | tr -d ' ' | ||
register: runcount | ||
until: runcount.stdout | int == 3 | ||
delay: 0.01 | ||
|
||
- assert: | ||
that: runcount.stdout | int == 3 | ||
|
||
- file: path="{{ until_tempfile_path }}" state=absent | ||
|
||
- name: loop with specified max retries | ||
shell: echo "run" >> {{ until_tempfile_path }} | ||
until: 1==0 | ||
retries: 5 | ||
delay: 0.01 | ||
ignore_errors: true | ||
|
||
- name: validate output | ||
shell: wc -l < {{ until_tempfile_path }} | ||
register: runcount | ||
|
||
- assert: | ||
that: runcount.stdout | int == 6 # initial + 5 retries | ||
|
||
- file: path="{{ until_tempfile_path }}" state=absent |