From dc7b34c87abf8c1ddf64921f223294ba1c26d275 Mon Sep 17 00:00:00 2001 From: eadderley <25034184+eadderley@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:36:09 -0500 Subject: [PATCH] feat: implement go based timeout for the test command (#82) * re-implement timeout * fix: trailing spaces --------- Co-authored-by: Eric Ribeiro --- src/commands/test.yml | 5 +++++ src/examples/test.yml | 3 ++- src/scripts/test.sh | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/commands/test.yml b/src/commands/test.yml index 8061819..e285d22 100644 --- a/src/commands/test.yml +++ b/src/commands/test.yml @@ -23,6 +23,10 @@ parameters: description: tell long-running tests to shorten their run time type: boolean default: false + timeout: + description: timeout the test and panic after value - for situations where a test has a valid usecase to go longer than 10m + type: string + default: "10m" parallel: description: | Allow parallel execution of test functions that call t.Parallel. @@ -63,6 +67,7 @@ steps: ORB_VAL_COUNT: <> ORB_VAL_FAIL_FAST: <> ORB_VAL_SHORT: <> + ORB_VAL_TIMEOUT: <> ORB_VAL_PARALLEL: <> ORB_VAL_COVER_MODE: <> ORB_VAL_VERBOSE: <> diff --git a/src/examples/test.yml b/src/examples/test.yml index 78d144b..a8e601a 100644 --- a/src/examples/test.yml +++ b/src/examples/test.yml @@ -24,4 +24,5 @@ usage: race: true failfast: true covermode: "atomic" # The preferred setting when enabling race - no_output_timeout: 15m # The amount of time to allow the go tests to run before timing out, defaults to "10m" + timeout: 15m #The amount of time to allow the go tests to run before timing out, defaults to "10m" + no_output_timeout: 15m # The amount of time to allow the orb to run without output before timing out, defaults to "10m" diff --git a/src/scripts/test.sh b/src/scripts/test.sh index 83bf55e..413e229 100644 --- a/src/scripts/test.sh +++ b/src/scripts/test.sh @@ -21,5 +21,6 @@ set -x go test -count="$ORB_VAL_COUNT" -coverprofile="$COVER_PROFILE" \ -p "$ORB_VAL_PARALLEL" -covermode="$ORB_VAL_COVER_MODE" \ "$ORB_VAL_PACKAGES" -coverpkg="$ORB_VAL_PACKAGES" \ + -timeout="$ORB_VAL_TIMEOUT" \ "$@" set +x