Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vault test matrix #4698

Merged
merged 7 commits into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ matrix:
env: RUN_STATIC_CHECKS=1 SKIP_NOMAD_TESTS=1
- os: osx
osx_image: xcode9.1
- os: linux
dist: trusty
sudo: required
env: RUN_E2E_TESTS=1 SKIP_NOMAD_TESTS=1
allow_failures:
# Allow osx to fail as its flaky
- os: osx
Expand Down
12 changes: 12 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,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
Expand All @@ -253,6 +256,15 @@ 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 \
github.com/hashicorp/nomad/e2e/vault/

.PHONY: clean
clean: GOPATH=$(shell go env GOPATH)
clean: ## Remove build artifacts
Expand Down
74 changes: 74 additions & 0 deletions e2e/vault/consts_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package vault

import (
"github.com/hashicorp/nomad/api"
"github.com/hashicorp/nomad/helper"
)

const (
// policy is the recommended Nomad Vault policy
policy = `path "auth/token/create/nomad-cluster" {
capabilities = ["update"]
}
path "auth/token/roles/nomad-cluster" {
capabilities = ["read"]
}
path "auth/token/lookup-self" {
capabilities = ["read"]
}

path "auth/token/lookup" {
capabilities = ["update"]
}
path "auth/token/revoke-accessor" {
capabilities = ["update"]
}
path "sys/capabilities-self" {
capabilities = ["update"]
}
path "auth/token/renew-self" {
capabilities = ["update"]
}`
)

var (
// role is the recommended nomad cluster role
role = map[string]interface{}{
"disallowed_policies": "nomad-server",
"explicit_max_ttl": 0,
"name": "nomad-cluster",
"orphan": false,
"period": 259200,
"renewable": true,
}

// job is a test job that is used to request a Vault token and cat the token
// out before exiting.
job = &api.Job{
ID: helper.StringToPtr("test"),
Type: helper.StringToPtr("batch"),
Datacenters: []string{"dc1"},
TaskGroups: []*api.TaskGroup{
{
Name: helper.StringToPtr("test"),
Tasks: []*api.Task{
{
Name: "test",
Driver: "raw_exec",
Config: map[string]interface{}{
"command": "cat",
"args": []string{"${NOMAD_SECRETS_DIR}/vault_token"},
},
Vault: &api.Vault{
Policies: []string{"default"},
},
},
},
RestartPolicy: &api.RestartPolicy{
Attempts: helper.IntToPtr(0),
Mode: helper.StringToPtr("fail"),
},
},
},
}
)
33 changes: 33 additions & 0 deletions e2e/vault/matrix_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package vault

var (
// versions is the set of Vault versions we test for backwards compatibility
versions = []string{
"0.11.1",
"0.11.0",
"0.10.4",
"0.10.3",
"0.10.2",
"0.10.1",
"0.10.0",
"0.9.6",
"0.9.5",
"0.9.4",
"0.9.3",
"0.9.2",
"0.9.1",
"0.9.0",
"0.8.3",
"0.8.2",
"0.8.1",
"0.8.0",
"0.7.3",
"0.7.2",
"0.7.1",
"0.7.0",
"0.6.5",
"0.6.4",
"0.6.3",
"0.6.2",
}
)
Loading