From 5e5173471218bb95a5c2cc0f1832a8c1b7023235 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Tue, 10 Oct 2023 14:38:54 -0400 Subject: [PATCH] Fixes Odd Exit Code (#10900) --- integration-tests/scripts/entrypoint | 4 +++- integration-tests/testsetups/keeper_benchmark.go | 2 -- integration-tests/testsetups/ocr.go | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/integration-tests/scripts/entrypoint b/integration-tests/scripts/entrypoint index 3955023685d..cb5c98fde6a 100755 --- a/integration-tests/scripts/entrypoint +++ b/integration-tests/scripts/entrypoint @@ -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 diff --git a/integration-tests/testsetups/keeper_benchmark.go b/integration-tests/testsetups/keeper_benchmark.go index ba0cc23b23b..2fd19d35cb3 100644 --- a/integration-tests/testsetups/keeper_benchmark.go +++ b/integration-tests/testsetups/keeper_benchmark.go @@ -132,8 +132,6 @@ func (k *KeeperBenchmarkTest) Setup(t *testing.T, env *environment.Environment) } } - var () - c := inputs.Contracts if common.IsHexAddress(c.LinkTokenAddress) { diff --git a/integration-tests/testsetups/ocr.go b/integration-tests/testsetups/ocr.go index 7781e6c114f..49ee8a69780 100644 --- a/integration-tests/testsetups/ocr.go +++ b/integration-tests/testsetups/ocr.go @@ -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 { @@ -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: