Skip to content

Commit

Permalink
feat: implement go based timeout for the test command (#82)
Browse files Browse the repository at this point in the history
* re-implement timeout

* fix: trailing spaces

---------

Co-authored-by: Eric Ribeiro <[email protected]>
  • Loading branch information
eadderley and Eric Ribeiro authored Jan 24, 2024
1 parent 77dcaa9 commit dc7b34c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/commands/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -63,6 +67,7 @@ steps:
ORB_VAL_COUNT: <<parameters.count>>
ORB_VAL_FAIL_FAST: <<parameters.failfast>>
ORB_VAL_SHORT: <<parameters.short>>
ORB_VAL_TIMEOUT: <<parameters.timeout>>
ORB_VAL_PARALLEL: <<parameters.parallel>>
ORB_VAL_COVER_MODE: <<parameters.covermode>>
ORB_VAL_VERBOSE: <<parameters.verbose>>
Expand Down
3 changes: 2 additions & 1 deletion src/examples/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
1 change: 1 addition & 0 deletions src/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit dc7b34c

Please sign in to comment.