From 2a98a59861ef1a99f7752e263ee54f38024474dc Mon Sep 17 00:00:00 2001 From: Nick Cabatoff Date: Tue, 1 Jun 2021 14:40:38 +0200 Subject: [PATCH] go_test.yml on ent has needlessly diverged from oss; make them identical again (#11731) --- .circleci/config.yml | 65 ++++++++++++++++++++------- .circleci/config/commands/go_test.yml | 17 +++++-- 2 files changed, 64 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e459a5eb1a..b8a7069c3a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -916,13 +916,13 @@ jobs: jq -r 'select(.Deps != null) | select(any(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker"))) | .ForTest | select(. != null)' | - sort -u | circleci tests split --split-by=timings --timings-type=classname) + sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) else package_names=$(go list -test -json ./... | jq -r 'select(.Deps != null) | select(all(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker")|not)) | .ForTest | select(. != null)' | - sort -u | circleci tests split --split-by=timings --timings-type=classname) + sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) fi # After running tests split step, we are now running the following steps @@ -933,6 +933,11 @@ jobs: make prep mkdir -p test-results/go-test + # Don't tempt fate by having the license env var populated: tests should + # have to use it explicitly (via env var VAULT_LICENSE_CI) rather than + # depending on an implicit behaviour. + VAULT_LICENSE= + # Create a docker network for our testcontainer if [ $USE_DOCKER == 1 ]; then # Despite the fact that we're using a circleci image (thus getting the @@ -963,6 +968,7 @@ jobs: docker exec -w /go/src/github.com/hashicorp/vault/ \ -e GO111MODULE -e CIRCLECI -e GOCACHE=/tmp/gocache -e VAULT_CI_GO_TEST_RACE \ + -e VAULT_LICENSE_CI \ testcontainer \ gotestsum --format=short-verbose \ --junitfile test-results/go-test/results.xml \ @@ -974,7 +980,8 @@ jobs: \ ${package_names} else - GOCACHE=/tmp/go-cache \ + GOARCH=amd64 \ + GOCACHE=/tmp/go-cache \ gotestsum --format=short-verbose \ --junitfile test-results/go-test/results.xml \ --jsonfile test-results/go-test/results.json \ @@ -1131,13 +1138,13 @@ jobs: jq -r 'select(.Deps != null) | select(any(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker"))) | .ForTest | select(. != null)' | - sort -u | circleci tests split --split-by=timings --timings-type=classname) + sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) else package_names=$(go list -test -json ./... | jq -r 'select(.Deps != null) | select(all(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker")|not)) | .ForTest | select(. != null)' | - sort -u | circleci tests split --split-by=timings --timings-type=classname) + sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) fi # After running tests split step, we are now running the following steps @@ -1148,6 +1155,11 @@ jobs: make prep mkdir -p test-results/go-test + # Don't tempt fate by having the license env var populated: tests should + # have to use it explicitly (via env var VAULT_LICENSE_CI) rather than + # depending on an implicit behaviour. + VAULT_LICENSE= + # Create a docker network for our testcontainer if [ $USE_DOCKER == 1 ]; then # Despite the fact that we're using a circleci image (thus getting the @@ -1178,6 +1190,7 @@ jobs: docker exec -w /go/src/github.com/hashicorp/vault/ \ -e GO111MODULE -e CIRCLECI -e GOCACHE=/tmp/gocache -e VAULT_CI_GO_TEST_RACE \ + -e VAULT_LICENSE_CI \ testcontainer \ gotestsum --format=short-verbose \ --junitfile test-results/go-test/results.xml \ @@ -1189,7 +1202,8 @@ jobs: -race \ ${package_names} else - GOCACHE=/tmp/go-cache \ + GOARCH=amd64 \ + GOCACHE=/tmp/go-cache \ gotestsum --format=short-verbose \ --junitfile test-results/go-test/results.xml \ --jsonfile test-results/go-test/results.json \ @@ -1597,13 +1611,13 @@ jobs: jq -r 'select(.Deps != null) | select(any(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker"))) | .ForTest | select(. != null)' | - sort -u | circleci tests split --split-by=timings --timings-type=classname) + sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) else package_names=$(go list -test -json ./... | jq -r 'select(.Deps != null) | select(all(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker")|not)) | .ForTest | select(. != null)' | - sort -u | circleci tests split --split-by=timings --timings-type=classname) + sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) fi # After running tests split step, we are now running the following steps @@ -1614,6 +1628,11 @@ jobs: make prep mkdir -p test-results/go-test + # Don't tempt fate by having the license env var populated: tests should + # have to use it explicitly (via env var VAULT_LICENSE_CI) rather than + # depending on an implicit behaviour. + VAULT_LICENSE= + # Create a docker network for our testcontainer if [ $USE_DOCKER == 1 ]; then # Despite the fact that we're using a circleci image (thus getting the @@ -1644,6 +1663,7 @@ jobs: docker exec -w /go/src/github.com/hashicorp/vault/ \ -e GO111MODULE -e CIRCLECI -e GOCACHE=/tmp/gocache -e VAULT_CI_GO_TEST_RACE \ + -e VAULT_LICENSE_CI \ testcontainer \ gotestsum --format=short-verbose \ --junitfile test-results/go-test/results.xml \ @@ -1655,7 +1675,8 @@ jobs: \ ${package_names} else - GOCACHE=/tmp/go-cache \ + GOARCH=amd64 \ + GOCACHE=/tmp/go-cache \ gotestsum --format=short-verbose \ --junitfile test-results/go-test/results.xml \ --jsonfile test-results/go-test/results.json \ @@ -1743,13 +1764,13 @@ jobs: jq -r 'select(.Deps != null) | select(any(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker"))) | .ForTest | select(. != null)' | - sort -u | circleci tests split --split-by=timings --timings-type=classname) + sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) else package_names=$(go list -test -json ./... | jq -r 'select(.Deps != null) | select(all(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker")|not)) | .ForTest | select(. != null)' | - sort -u | circleci tests split --split-by=timings --timings-type=classname) + sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) fi # After running tests split step, we are now running the following steps @@ -1760,6 +1781,11 @@ jobs: make prep mkdir -p test-results/go-test + # Don't tempt fate by having the license env var populated: tests should + # have to use it explicitly (via env var VAULT_LICENSE_CI) rather than + # depending on an implicit behaviour. + VAULT_LICENSE= + # Create a docker network for our testcontainer if [ $USE_DOCKER == 1 ]; then # Despite the fact that we're using a circleci image (thus getting the @@ -1790,6 +1816,7 @@ jobs: docker exec -w /go/src/github.com/hashicorp/vault/ \ -e GO111MODULE -e CIRCLECI -e GOCACHE=/tmp/gocache -e VAULT_CI_GO_TEST_RACE \ + -e VAULT_LICENSE_CI \ testcontainer \ gotestsum --format=short-verbose \ --junitfile test-results/go-test/results.xml \ @@ -1801,7 +1828,8 @@ jobs: \ ${package_names} else - GOCACHE=/tmp/go-cache \ + GOARCH=amd64 \ + GOCACHE=/tmp/go-cache \ gotestsum --format=short-verbose \ --junitfile test-results/go-test/results.xml \ --jsonfile test-results/go-test/results.json \ @@ -2340,13 +2368,13 @@ jobs: jq -r 'select(.Deps != null) | select(any(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker"))) | .ForTest | select(. != null)' | - sort -u | circleci tests split --split-by=timings --timings-type=classname) + sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) else package_names=$(go list -test -json ./... | jq -r 'select(.Deps != null) | select(all(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker")|not)) | .ForTest | select(. != null)' | - sort -u | circleci tests split --split-by=timings --timings-type=classname) + sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) fi # After running tests split step, we are now running the following steps @@ -2357,6 +2385,11 @@ jobs: make prep mkdir -p test-results/go-test + # Don't tempt fate by having the license env var populated: tests should + # have to use it explicitly (via env var VAULT_LICENSE_CI) rather than + # depending on an implicit behaviour. + VAULT_LICENSE= + # Create a docker network for our testcontainer if [ $USE_DOCKER == 1 ]; then # Despite the fact that we're using a circleci image (thus getting the @@ -2387,6 +2420,7 @@ jobs: docker exec -w /go/src/github.com/hashicorp/vault/ \ -e GO111MODULE -e CIRCLECI -e GOCACHE=/tmp/gocache -e VAULT_CI_GO_TEST_RACE \ + -e VAULT_LICENSE_CI \ testcontainer \ gotestsum --format=short-verbose \ --junitfile test-results/go-test/results.xml \ @@ -2398,7 +2432,8 @@ jobs: -race \ ${package_names} else - GOCACHE=/tmp/go-cache \ + GOARCH=amd64 \ + GOCACHE=/tmp/go-cache \ gotestsum --format=short-verbose \ --junitfile test-results/go-test/results.xml \ --jsonfile test-results/go-test/results.json \ diff --git a/.circleci/config/commands/go_test.yml b/.circleci/config/commands/go_test.yml index 27a2951cdf..fb57623ab1 100644 --- a/.circleci/config/commands/go_test.yml +++ b/.circleci/config/commands/go_test.yml @@ -18,6 +18,10 @@ parameters: use_docker: type: boolean default: false + arch: + type: string + # Only supported for use_docker=false, and only other value allowed is 386 + default: amd64 steps: - run: name: Compute test cache key @@ -55,13 +59,13 @@ steps: jq -r 'select(.Deps != null) | select(any(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker"))) | .ForTest | select(. != null)' | - sort -u | circleci tests split --split-by=timings --timings-type=classname) + sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) else package_names=$(go list -test -json ./... | jq -r 'select(.Deps != null) | select(all(.Deps[] ; contains("github.com/hashicorp/vault/helper/testhelpers/docker")|not)) | .ForTest | select(. != null)' | - sort -u | circleci tests split --split-by=timings --timings-type=classname) + sort -u | grep -v vault/integ | circleci tests split --split-by=timings --timings-type=classname) fi # After running tests split step, we are now running the following steps @@ -72,6 +76,11 @@ steps: make prep mkdir -p test-results/go-test + # Don't tempt fate by having the license env var populated: tests should + # have to use it explicitly (via env var VAULT_LICENSE_CI) rather than + # depending on an implicit behaviour. + VAULT_LICENSE= + # Create a docker network for our testcontainer if [ $USE_DOCKER == 1 ]; then # Despite the fact that we're using a circleci image (thus getting the @@ -102,6 +111,7 @@ steps: docker exec -w /go/src/github.com/hashicorp/vault/ \ -e GO111MODULE -e CIRCLECI -e GOCACHE=/tmp/gocache -e VAULT_CI_GO_TEST_RACE \ + -e VAULT_LICENSE_CI \ testcontainer \ gotestsum --format=short-verbose \ --junitfile test-results/go-test/results.xml \ @@ -113,7 +123,8 @@ steps: << parameters.extra_flags >> \ ${package_names} else - GOCACHE=<< parameters.cache_dir >> \ + GOARCH=<< parameters.arch >> \ + GOCACHE=<< parameters.cache_dir >> \ gotestsum --format=short-verbose \ --junitfile test-results/go-test/results.xml \ --jsonfile test-results/go-test/results.json \