File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,12 @@ The format is based on [Keep a Changelog][kac] and this project adheres to
88[ kac ] : https://keepachangelog.com/en/1.0.0/
99[ semver ] : https://semver.org/
1010
11+ ## [ Unreleased]
12+
13+ ### Fixed
14+
15+ * fix non zero return code on successful retried tests (#670 )
16+
1117## [ 1.8.1] - 2022-10-19
1218
1319### Fixed
Original file line number Diff line number Diff line change @@ -221,6 +221,7 @@ bats_run_test_with_retries() { # <args>
221221 status=$?
222222 if (( status == BATS_RETRY_RETURN_CODE)) ; then
223223 should_try_again=1
224+ status=0 # this is not the last try -> reset status
224225 else
225226 should_try_again=0
226227 bats_exec_file_status=$status
Original file line number Diff line number Diff line change @@ -1433,6 +1433,7 @@ enforce_own_process_group() {
14331433}
14341434
14351435@test " BATS_TEST_RETRIES allows for retrying tests" {
1436+ # shellcheck disable=SC2030
14361437 export LOG=" $BATS_TEST_TMPDIR /call.log"
14371438 bats_require_minimum_version 1.5.0
14381439 reentrant_run ! bats " $FIXTURE_ROOT /retry.bats"
@@ -1480,3 +1481,13 @@ enforce_own_process_group() {
14801481 [ " ${# lines[@]} " -eq 6 ]
14811482
14821483}
1484+
1485+ @test " Exit code is zero after successful retry (see #660)" {
1486+ # shellcheck disable=SC2031
1487+ export LOG=" $BATS_TEST_TMPDIR /call.log"
1488+ bats_require_minimum_version 1.5.0
1489+ reentrant_run -0 bats " $FIXTURE_ROOT /retry_success.bats"
1490+ [ " ${lines[0]} " == ' 1..1' ]
1491+ [ " ${lines[1]} " == ' ok 1 Fail once' ]
1492+ [ ${# lines[@]} == 2 ]
1493+ }
Original file line number Diff line number Diff line change 1+ # shellcheck disable=SC2034
2+ BATS_TEST_RETRIES=2 # means three tries per test
3+
4+ @test " Fail once" {
5+ (( BATS_TEST_TRY_NUMBER > 1 )) || false
6+ }
You can’t perform that action at this time.
0 commit comments