Catch test errors that break go list (#13017)

This commit is contained in:
Nick Cabatoff 2021-11-03 09:00:38 -04:00 committed by GitHub
parent 418c311b14
commit 72c31832e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 25 deletions

40
.circleci/config.yml generated
View File

@ -977,7 +977,7 @@ jobs:
name: Restore exact go modules cache
- run:
command: |
set -x
set -exo pipefail
EXTRA_TAGS=
case "" in
@ -1002,18 +1002,18 @@ jobs:
for dir in "${modules[@]}"
do
pushd "$dir"
# On its own line so that -e will fail the tests if we detect errors here.
go list -test -json ./... > test-list.json
# Split Go tests by prior test times. If use_docker is true, only run
# tests that depend on docker, otherwise only those that don't.
# The appended true condition ensures the command will succeed if no packages are found
if [ $USE_DOCKER == 1 ]; then
package_names=$(go list -test -json ./... |
jq -r 'select(.Deps != null) |
package_names=$(< test-list.json jq -r 'select(.Deps != null) |
select(any(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker"))) |
.ForTest | select(. != null)' |
sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) || true
else
package_names=$(go list -test -json ./... |
jq -r 'select(.Deps != null) |
package_names=$(< test-list-json jq -r 'select(.Deps != null) |
select(all(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker")|not)) |
.ForTest | select(. != null)' |
sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) || true
@ -1249,7 +1249,7 @@ jobs:
name: Restore exact go modules cache
- run:
command: |
set -x
set -exo pipefail
EXTRA_TAGS=
case "-race" in
@ -1273,18 +1273,18 @@ jobs:
for dir in "${modules[@]}"
do
pushd "$dir"
# On its own line so that -e will fail the tests if we detect errors here.
go list -test -json ./... > test-list.json
# Split Go tests by prior test times. If use_docker is true, only run
# tests that depend on docker, otherwise only those that don't.
# The appended true condition ensures the command will succeed if no packages are found
if [ $USE_DOCKER == 1 ]; then
package_names=$(go list -test -json ./... |
jq -r 'select(.Deps != null) |
package_names=$(< test-list.json jq -r 'select(.Deps != null) |
select(any(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker"))) |
.ForTest | select(. != null)' |
sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) || true
else
package_names=$(go list -test -json ./... |
jq -r 'select(.Deps != null) |
package_names=$(< test-list-json jq -r 'select(.Deps != null) |
select(all(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker")|not)) |
.ForTest | select(. != null)' |
sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) || true
@ -1771,7 +1771,7 @@ jobs:
name: Restore exact go modules cache
- run:
command: |
set -x
set -exo pipefail
EXTRA_TAGS=
case "" in
@ -1795,18 +1795,18 @@ jobs:
for dir in "${modules[@]}"
do
pushd "$dir"
# On its own line so that -e will fail the tests if we detect errors here.
go list -test -json ./... > test-list.json
# Split Go tests by prior test times. If use_docker is true, only run
# tests that depend on docker, otherwise only those that don't.
# The appended true condition ensures the command will succeed if no packages are found
if [ $USE_DOCKER == 1 ]; then
package_names=$(go list -test -json ./... |
jq -r 'select(.Deps != null) |
package_names=$(< test-list.json jq -r 'select(.Deps != null) |
select(any(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker"))) |
.ForTest | select(. != null)' |
sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) || true
else
package_names=$(go list -test -json ./... |
jq -r 'select(.Deps != null) |
package_names=$(< test-list-json jq -r 'select(.Deps != null) |
select(all(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker")|not)) |
.ForTest | select(. != null)' |
sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) || true
@ -2436,7 +2436,7 @@ jobs:
name: Restore exact go modules cache
- run:
command: |
set -x
set -exo pipefail
EXTRA_TAGS=
case "-race" in
@ -2461,18 +2461,18 @@ jobs:
for dir in "${modules[@]}"
do
pushd "$dir"
# On its own line so that -e will fail the tests if we detect errors here.
go list -test -json ./... > test-list.json
# Split Go tests by prior test times. If use_docker is true, only run
# tests that depend on docker, otherwise only those that don't.
# The appended true condition ensures the command will succeed if no packages are found
if [ $USE_DOCKER == 1 ]; then
package_names=$(go list -test -json ./... |
jq -r 'select(.Deps != null) |
package_names=$(< test-list.json jq -r 'select(.Deps != null) |
select(any(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker"))) |
.ForTest | select(. != null)' |
sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) || true
else
package_names=$(go list -test -json ./... |
jq -r 'select(.Deps != null) |
package_names=$(< test-list-json jq -r 'select(.Deps != null) |
select(all(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker")|not)) |
.ForTest | select(. != null)' |
sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) || true

View File

@ -38,7 +38,7 @@ steps:
environment:
GOPRIVATE: 'github.com/hashicorp/*'
command: |
set -x
set -exo pipefail
EXTRA_TAGS=
case "<< parameters.extra_flags >>" in
@ -65,18 +65,18 @@ steps:
for dir in "${modules[@]}"
do
pushd "$dir"
# On its own line so that -e will fail the tests if we detect errors here.
go list -test -json ./... > test-list.json
# Split Go tests by prior test times. If use_docker is true, only run
# tests that depend on docker, otherwise only those that don't.
# The appended true condition ensures the command will succeed if no packages are found
if [ $USE_DOCKER == 1 ]; then
package_names=$(go list -test -json ./... |
jq -r 'select(.Deps != null) |
package_names=$(< test-list.json jq -r 'select(.Deps != null) |
select(any(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker"))) |
.ForTest | select(. != null)' |
sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) || true
else
package_names=$(go list -test -json ./... |
jq -r 'select(.Deps != null) |
package_names=$(< test-list-json jq -r 'select(.Deps != null) |
select(all(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker")|not)) |
.ForTest | select(. != null)' |
sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) || true