From b81e93509da3e7893c8facb7d31f9d4d6af467ae Mon Sep 17 00:00:00 2001 From: Jon Smock Date: Tue, 3 Dec 2024 15:57:39 +0000 Subject: [PATCH] Test repeat when run command returns non-zero exit code --- examples/00-intro.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples/00-intro.yaml b/examples/00-intro.yaml index 3b51ed6..4ac533e 100644 --- a/examples/00-intro.yaml +++ b/examples/00-intro.yaml @@ -76,7 +76,21 @@ tests: steps: - exec: node1 run: rm -f repeat-test-file + + - name: Repeat on non-zero exit code + exec: node1 + repeat: { retries: 2, interval: '1s' } + run: | + if [ ! -f repeat-test-file ]; then + touch repeat-test-file + exit 1 + fi + - exec: node1 + run: rm -f repeat-test-file + + - name: Repeat on failed expect assertion + exec: node1 repeat: { retries: 2, interval: '1s' } run: | if [ ! -f repeat-test-file ]; then @@ -86,5 +100,6 @@ tests: fi expect: - step.stdout == "Repeated successfully" + - exec: node1 run: rm -f repeat-test-file