From 5be738d2c4d376079ce5e35bbe8ce859b16568a7 Mon Sep 17 00:00:00 2001 From: Cody Oss Date: Thu, 11 Aug 2022 09:10:57 -0500 Subject: [PATCH] chore: fix flaky bot --- internal/kokoro/test.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/internal/kokoro/test.sh b/internal/kokoro/test.sh index f4c2824f2fa..8b5d89ca182 100755 --- a/internal/kokoro/test.sh +++ b/internal/kokoro/test.sh @@ -50,16 +50,27 @@ cd google-api-go-generator go generate cd .. +set +e # Run all tests, don't stop after the first failure. +exit_code=0 + # Run tests and tee output to log file, to be pushed to GCS as artifact. if [[ $KOKORO_JOB_NAME == *"continuous"* ]]; then go test -race -v ./... 2>&1 | tee $KOKORO_ARTIFACTS_DIR/$KOKORO_GERRIT_CHANGE_NUMBER.txt + # Takes the kokoro output log (raw stdout) and creates a machine-parseable + # xUnit XML file. + cat $KOKORO_ARTIFACTS_DIR/$KOKORO_GERRIT_CHANGE_NUMBER.txt | + go-junit-report -set-exit-code >sponge_log.xml + exit_code=$($?) else go test -race -v -short ./... 2>&1 | tee $KOKORO_ARTIFACTS_DIR/$KOKORO_GERRIT_CHANGE_NUMBER.txt + exit_code=$($?) fi if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot -logs_dir=$GOCLOUD_HOME \ - -repo=googleapis/google-api-go-client \ - -commit_hash=$KOKORO_GITHUB_COMMIT_URL_google_api_go_client + chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot + $KOKORO_GFILE_DIR/linux_amd64/flakybot -logs_dir=$GOCLOUD_HOME \ + -repo=googleapis/google-api-go-client \ + -commit_hash=$KOKORO_GITHUB_COMMIT_URL_google_api_go_client fi + +exit $exit_code