From 3dad84057e0d188f7b01adb9824dbb087a4de533 Mon Sep 17 00:00:00 2001 From: Cody Oss <6331106+codyoss@users.noreply.github.com> Date: Tue, 30 Aug 2022 14:29:36 -0500 Subject: [PATCH] chore: don't test tools with earliest (#6589) 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. --- internal/kokoro/continuous.sh | 10 ++++++++-- internal/kokoro/presubmit.sh | 10 +++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/internal/kokoro/continuous.sh b/internal/kokoro/continuous.sh index 709025dfdc9..6b6ad72379b 100755 --- a/internal/kokoro/continuous.sh +++ b/internal/kokoro/continuous.sh @@ -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 \ diff --git a/internal/kokoro/presubmit.sh b/internal/kokoro/presubmit.sh index 210557b156d..45cf45ed5ca 100755 --- a/internal/kokoro/presubmit.sh +++ b/internal/kokoro/presubmit.sh @@ -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 @@ -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