Skip to content

Commit

Permalink
Fixes Odd Exit Code (#10900)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalverra authored Oct 10, 2023
1 parent 7b926c8 commit 5e51734
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion integration-tests/scripts/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ exit_code=$?

echo "Test exit code: ${exit_code}"

if [ $exit_code -eq 2 ]; then # 2 is the code for an interrupted test, we only want to restart the test when the test is interrupted
# 3 is the code for an interrupted test, we only want to restart the test when the test is interrupted and in a state
# that it can recover from. Otherwise we mark the test as "passed" as far as K8s is concerned so it doesn't restart it.
if [ $exit_code -eq 3 ]; then
exit 1 # Exiting with non-zero status to trigger pod restart
fi

Expand Down
2 changes: 0 additions & 2 deletions integration-tests/testsetups/keeper_benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ func (k *KeeperBenchmarkTest) Setup(t *testing.T, env *environment.Environment)
}
}

var ()

c := inputs.Contracts

if common.IsHexAddress(c.LinkTokenAddress) {
Expand Down
7 changes: 5 additions & 2 deletions integration-tests/testsetups/ocr.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ import (
"github.com/smartcontractkit/chainlink/integration-tests/testreporters"
)

const saveFileLocation = "/persistence/ocr-soak-test-state.toml"
const (
saveFileLocation = "/persistence/ocr-soak-test-state.toml"
interruptedExitCode = 3
)

// OCRSoakTest defines a typical OCR soak test
type OCRSoakTest struct {
Expand Down Expand Up @@ -485,7 +488,7 @@ func (o *OCRSoakTest) testLoop(testDuration time.Duration, newValue int) {
o.log.Error().Err(err).Msg("Error saving state")
}
o.log.Warn().Str("Time Taken", time.Since(saveStart).String()).Msg("Saved state")
os.Exit(2) // Exit with code 2 to indicate test was interrupted, not just a normal failure
os.Exit(interruptedExitCode) // Exit with interrupted code to indicate test was interrupted, not just a normal failure
case <-endTest:
return
case <-newRoundTrigger.C:
Expand Down

0 comments on commit 5e51734

Please sign in to comment.