commit
732efc3cae
6
Makefile
6
Makefile
|
@ -18,7 +18,7 @@ dev: generate
|
|||
|
||||
# test runs the unit tests and vets the code
|
||||
test: generate
|
||||
VAULT_TOKEN= TF_ACC= go test $(TEST) $(TESTARGS) -timeout=120s -parallel=4
|
||||
VAULT_TOKEN= VAULT_ACC= go test $(TEST) $(TESTARGS) -timeout=120s -parallel=4
|
||||
|
||||
# testacc runs acceptance tests
|
||||
testacc: generate
|
||||
|
@ -26,11 +26,11 @@ testacc: generate
|
|||
echo "ERROR: Set TEST to a specific package"; \
|
||||
exit 1; \
|
||||
fi
|
||||
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 45m
|
||||
VAULT_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 45m
|
||||
|
||||
# testrace runs the race checker
|
||||
testrace: generate
|
||||
CGO_ENABLED=1 VAULT_TOKEN= TF_ACC= go test -race $(TEST) $(TESTARGS)
|
||||
CGO_ENABLED=1 VAULT_TOKEN= VAULT_ACC= go test -race $(TEST) $(TESTARGS)
|
||||
|
||||
cover:
|
||||
./scripts/coverage.sh --html
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
func TestBackend_basic(t *testing.T) {
|
||||
if os.Getenv("TF_ACC") == "" {
|
||||
if os.Getenv("VAULT_ACC") == "" {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ func TestBackend_basic(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestBackend_management(t *testing.T) {
|
||||
if os.Getenv("TF_ACC") == "" {
|
||||
if os.Getenv("VAULT_ACC") == "" {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ func TestBackend_management(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestBackend_crud(t *testing.T) {
|
||||
if os.Getenv("TF_ACC") == "" {
|
||||
if os.Getenv("VAULT_ACC") == "" {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ func TestBackend_crud(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestBackend_role_lease(t *testing.T) {
|
||||
if os.Getenv("TF_ACC") == "" {
|
||||
if os.Getenv("VAULT_ACC") == "" {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ var (
|
|||
// Performs basic tests on CA functionality
|
||||
// Uses the RSA CA key
|
||||
func TestBackend_RSAKey(t *testing.T) {
|
||||
if os.Getenv("TF_ACC") == "" {
|
||||
if os.Getenv("VAULT_ACC") == "" {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ func TestBackend_RSAKey(t *testing.T) {
|
|||
// Performs basic tests on CA functionality
|
||||
// Uses the EC CA key
|
||||
func TestBackend_ECKey(t *testing.T) {
|
||||
if os.Getenv("TF_ACC") == "" {
|
||||
if os.Getenv("VAULT_ACC") == "" {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ func TestBackend_ECKey(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestBackend_CSRValues(t *testing.T) {
|
||||
if os.Getenv("TF_ACC") == "" {
|
||||
if os.Getenv("VAULT_ACC") == "" {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ func TestBackend_CSRValues(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestBackend_URLsCRUD(t *testing.T) {
|
||||
if os.Getenv("TF_ACC") == "" {
|
||||
if os.Getenv("VAULT_ACC") == "" {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ func TestBackend_URLsCRUD(t *testing.T) {
|
|||
// of role flags to ensure that they are properly restricted
|
||||
// Uses the RSA CA key
|
||||
func TestBackend_RSARoles(t *testing.T) {
|
||||
if os.Getenv("TF_ACC") == "" {
|
||||
if os.Getenv("VAULT_ACC") == "" {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ func TestBackend_RSARoles(t *testing.T) {
|
|||
// of role flags to ensure that they are properly restricted
|
||||
// Uses the RSA CA key
|
||||
func TestBackend_RSARoles_CSR(t *testing.T) {
|
||||
if os.Getenv("TF_ACC") == "" {
|
||||
if os.Getenv("VAULT_ACC") == "" {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ func TestBackend_RSARoles_CSR(t *testing.T) {
|
|||
// of role flags to ensure that they are properly restricted
|
||||
// Uses the EC CA key
|
||||
func TestBackend_ECRoles(t *testing.T) {
|
||||
if os.Getenv("TF_ACC") == "" {
|
||||
if os.Getenv("VAULT_ACC") == "" {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -314,7 +314,7 @@ func TestBackend_ECRoles(t *testing.T) {
|
|||
// of role flags to ensure that they are properly restricted
|
||||
// Uses the EC CA key
|
||||
func TestBackend_ECRoles_CSR(t *testing.T) {
|
||||
if os.Getenv("TF_ACC") == "" {
|
||||
if os.Getenv("VAULT_ACC") == "" {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -554,7 +554,7 @@ func TestKeyUpgrade(t *testing.T) {
|
|||
|
||||
func TestPolicyFuzzing(t *testing.T) {
|
||||
// Don't run if not during acceptance tests
|
||||
if os.Getenv("TF_ACC") == "" {
|
||||
if os.Getenv("VAULT_ACC") == "" {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
)
|
||||
|
||||
// TestEnvVar must be set to a non-empty value for acceptance tests to run.
|
||||
const TestEnvVar = "TF_ACC"
|
||||
const TestEnvVar = "VAULT_ACC"
|
||||
|
||||
// TestCase is a single set of tests to run for a backend. A TestCase
|
||||
// should generally map 1:1 to each test method for your acceptance
|
||||
|
@ -45,7 +45,7 @@ type TestCase struct {
|
|||
Teardown TestTeardownFunc
|
||||
|
||||
// AcceptanceTest, if set, the test case will be run only if
|
||||
// the environment variable TF_ACC is set. If not this test case
|
||||
// the environment variable VAULT_ACC is set. If not this test case
|
||||
// will be run as a unit test.
|
||||
AcceptanceTest bool
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ type TestTeardownFunc func() error
|
|||
|
||||
// Test performs an acceptance test on a backend with the given test case.
|
||||
//
|
||||
// Tests are not run unless an environmental variable "TF_ACC" is
|
||||
// Tests are not run unless an environmental variable "VAULT_ACC" is
|
||||
// set to some non-empty value. This is to avoid test cases surprising
|
||||
// a user by creating real resources.
|
||||
//
|
||||
|
|
8
make.bat
8
make.bat
|
@ -44,7 +44,7 @@ REM testacc runs acceptance tests.
|
|||
call :testsetup
|
||||
if x%_TEST% == x./... goto testacc_fail
|
||||
if x%_TEST% == x.\... goto testacc_fail
|
||||
set TF_ACC=1
|
||||
set VAULT_ACC=1
|
||||
go test %_TEST% -v %TESTARGS% -timeout 45m
|
||||
exit /b %ERRORLEVEL%
|
||||
:testacc_fail
|
||||
|
@ -57,13 +57,13 @@ REM testrace runs the race checker.
|
|||
go test -race %_TEST% %TESTARGS%
|
||||
exit /b %ERRORLEVEL%
|
||||
|
||||
REM testsetup calls `go generate` and defines the variables TF_ACC
|
||||
REM and _TEST. TF_ACC is always cleared. _TEST defaults to the value
|
||||
REM testsetup calls `go generate` and defines the variables VAULT_ACC
|
||||
REM and _TEST. VAULT_ACC is always cleared. _TEST defaults to the value
|
||||
REM of the TEST environment variable, provided that TEST is defined,
|
||||
REM otherwise _TEST it is set to "./...".
|
||||
:testsetup
|
||||
call :generate
|
||||
set TF_ACC=
|
||||
set VAULT_ACC=
|
||||
set _TEST=./...
|
||||
if defined TEST set _TEST=%TEST%
|
||||
goto :eof
|
||||
|
|
Loading…
Reference in a new issue