From 0d61369fcd66d6120cbc2741a1b5e6c315797b64 Mon Sep 17 00:00:00 2001 From: Kit Patella Date: Tue, 17 Dec 2019 13:22:32 -0800 Subject: [PATCH] Add CI test-integrations job for connect Vault CA provider (#6949) * vault-ca-provider: add make target and CI test-integration job for /agent/connect/ca/ Vault Provider tests * load env vars in the vault-ca-provider ci job * add checkout task, see if we need to attach workspace or not * ci: remove vault dependency from go-test job to ensure we only run the vault-provider tests in their job * ci: fix from RB and Alvin code review, add mod cache after checkout * ci: add CI context to make target and store test results * ci: fix whitespace * ci: create test results directory before we try to write to it --- .circleci/config.yml | 31 +++++++++++++++++++++++++++---- GNUmakefile | 10 ++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ed78e2d4a..e41f398374 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -107,10 +107,6 @@ jobs: - run: mkdir -p $TEST_RESULTS_DIR - run: sudo apt-get update && sudo apt-get install -y rsyslog - run: sudo service rsyslog start - - run: | - wget -q -O /tmp/vault.zip https://releases.hashicorp.com/vault/${VAULT_BINARY_VERSION}/vault_${VAULT_BINARY_VERSION}_linux_amd64.zip - sudo unzip -d /usr/local/bin /tmp/vault.zip - rm -rf /tmp/vault* - run: | PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname) gotestsum --format=short-verbose --junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- -tags=$GOTAGS -p 2 -cover -coverprofile=cov_$CIRCLE_NODE_INDEX.part $PACKAGE_NAMES @@ -560,6 +556,30 @@ jobs: ENVOY_VERSIONS: "1.11.1" steps: *ENVOY_INTEGRATION_TEST_STEPS + # run tests on vault ca provider integration tests + vault-ca-provider: + docker: + - image: *GOLANG_IMAGE + environment: + <<: *ENVIRONMENT + steps: + # Install vault + - run: | + wget -q -O /tmp/vault.zip https://releases.hashicorp.com/vault/${VAULT_BINARY_VERSION}/vault_${VAULT_BINARY_VERSION}_linux_amd64.zip + sudo unzip -d /usr/local/bin /tmp/vault.zip + rm -rf /tmp/vault* + # Create directory to store test results + - run: mkdir -p $TEST_RESULTS_DIR + # Gather deps to run go tests + - checkout + - restore_cache: + keys: + - consul-modcache-v1-{{ checksum "go.mod" }} + # Run go tests + - run: make test-vault-ca-provider + - store_test_results: + path: /tmp/test-results + workflows: version: 2 go-tests: @@ -631,6 +651,9 @@ workflows: - envoy-integration-test-1.11.1: requires: - dev-build + - vault-ca-provider: + requires: + - dev-build website: jobs: - build-website diff --git a/GNUmakefile b/GNUmakefile index f50a09994d..43fdf79f91 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -373,6 +373,16 @@ ui-docker: ui-build-image test-envoy-integ: $(ENVOY_INTEG_DEPS) @$(SHELL) $(CURDIR)/test/integration/connect/envoy/run-tests.sh +test-vault-ca-provider: +ifeq ("$(CIRCLECI)","true") +# Run in CI + gotestsum --format=short-verbose --junitfile "$(TEST_RESULTS_DIR)/gotestsum-report.xml" -- $(CURDIR)/agent/connect/ca/* -run TestVaultCAProvider +else +# Run locally + @echo "Running /agent/connect/ca TestVaultCAProvider tests in verbose mode" + @go test $(CURDIR)/agent/connect/ca/* -run TestVaultCAProvider -v +endif + proto-delete: @echo "Removing $(PROTOGOFILES)" -@rm $(PROTOGOFILES)