Skip to content

Commit

Permalink
chore: don't test tools with earliest (#6589)
Browse files Browse the repository at this point in the history
Our tools are only expected to run with the latest go version we
support. So for those directories skip running tests on old Go
versions.
  • Loading branch information
codyoss committed Aug 30, 2022
1 parent d81bb7e commit 3dad840
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 8 additions & 2 deletions internal/kokoro/continuous.sh
Expand Up @@ -79,8 +79,14 @@ try3 go mod download
# runDirectoryTests runs all tests in the current directory.
# If a PATH argument is specified, it runs `go test [PATH]`.
runDirectoryTests() {
go test -race -v -timeout 45m "${1:-./...}" 2>&1 \
| tee sponge_log.log
if [[ $PWD != *"/internal/"* ]] ||
[[ $PWD != *"/third_party/"* ]] &&
[[ $KOKORO_JOB_NAME == *"earliest"* ]]; then
# internal tools only expected to work with latest go version
return
fi
go test -race -v -timeout 45m "${1:-./...}" 2>&1 |
tee sponge_log.log
# Takes the kokoro output log (raw stdout) and creates a machine-parseable
# xUnit XML file.
cat sponge_log.log \
Expand Down
10 changes: 7 additions & 3 deletions internal/kokoro/presubmit.sh
Expand Up @@ -49,6 +49,13 @@ exit_code=0
# Run tests in the current directory and tee output to log file,
# to be pushed to GCS as artifact.
runPresubmitTests() {
if [[ $PWD != *"/internal/"* ]] ||
[[ $PWD != *"/third_party/"* ]] &&
[[ $KOKORO_JOB_NAME == *"earliest"* ]]; then
# internal tools only expected to work with latest go version
return
fi

if [ -z ${RUN_INTEGRATION_TESTS} ]; then
go test -race -v -timeout 15m -short ./... 2>&1 |
tee sponge_log.log
Expand All @@ -67,9 +74,6 @@ runPresubmitTests() {
go-junit-report -set-exit-code >sponge_log.xml
# Add the exit codes together so we exit non-zero if any module fails.
exit_code=$(($exit_code + $?))
# There are some types of build failures that go-junit-report does not
# properly handle. We can be safe here and run go build as well to catch such
# failures.
if [[ $PWD != *"/internal/"* ]]; then
go build ./...
fi
Expand Down

0 comments on commit 3dad840

Please sign in to comment.