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
This commit is contained in:
Kit Patella 2019-12-17 13:22:32 -08:00 committed by GitHub
parent 87679a7a4f
commit 0d61369fcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 4 deletions

View File

@ -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

View File

@ -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)