From 96f4e9a47d527e0054a031acc93236a739d707d4 Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Tue, 14 Jan 2020 13:47:51 -0800 Subject: [PATCH] test: restore e2e-test target and use -integration --- GNUmakefile | 14 ++++++++++++++ e2e/vault/README.md | 7 +++++-- e2e/vault/vault_test.go | 6 ++++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index d48d82f9a..a56d32d5d 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -263,6 +263,9 @@ test: ## Run the Nomad test suite and/or the Nomad UI test suite @if [ $(RUN_UI_TESTS) ]; then \ make test-ui; \ fi + @if [ $(RUN_E2E_TESTS) ]; then \ + make e2e-test; \ + fi .PHONY: test-nomad test-nomad: dev ## Run Nomad test suites @@ -277,6 +280,17 @@ test-nomad: dev ## Run Nomad test suites bash -C "$(PROJECT_ROOT)/scripts/test_check.sh" ; \ fi +.PHONY: e2e-test +e2e-test: dev ## Run the Nomad e2e test suite + @echo "==> Running Nomad E2E test suites:" + go test \ + $(if $(ENABLE_RACE),-race) $(if $(VERBOSE),-v) \ + -cover \ + -timeout=900s \ + -tags "$(GO_TAGS)" \ + github.com/hashicorp/nomad/e2e/vault/ \ + -integration + .PHONY: clean clean: GOPATH=$(shell go env GOPATH) clean: ## Remove build artifacts diff --git a/e2e/vault/README.md b/e2e/vault/README.md index 79d56bd2c..189840bad 100644 --- a/e2e/vault/README.md +++ b/e2e/vault/README.md @@ -1,12 +1,15 @@ # Vault Integration Test +Not run as part of nightly e2e suite at this point. + Downloads, caches, and tests Nomad against open source Vault binaries. Runs -only when `NOMAD_E2E` is set. +only when `-integration` is set. Run with: ``` -NOMAD_E2E=1 go test +cd e2e/vault/ +go test -integration ``` **Warning: Downloads a lot of Vault versions!** diff --git a/e2e/vault/vault_test.go b/e2e/vault/vault_test.go index fe008e6a4..fed40e717 100644 --- a/e2e/vault/vault_test.go +++ b/e2e/vault/vault_test.go @@ -5,6 +5,7 @@ import ( "bytes" "context" "encoding/json" + "flag" "fmt" "io" "io/ioutil" @@ -28,6 +29,7 @@ import ( ) var ( + integration = flag.Bool("integration", false, "run integration tests") minVaultVer = version.Must(version.NewVersion("0.6.2")) ) @@ -248,8 +250,8 @@ func getVault(dst, url string) error { // TestVaultCompatibility tests compatibility across Vault versions func TestVaultCompatibility(t *testing.T) { - if os.Getenv("NOMAD_E2E") == "" { - t.Skip("Skipping e2e tests, NOMAD_E2E not set") + if !*integration { + t.Skip("skipping test in non-integration mode: add -integration flag to run") } vaultBinaries := syncVault(t)