5
5
"encoding/json"
6
6
"fmt"
7
7
"io/ioutil"
8
- "os"
9
- "os/exec"
10
8
"testing"
11
9
"time"
12
10
@@ -40,7 +38,7 @@ func TestVaultCAProvider_VaultTLSConfig(t *testing.T) {
40
38
func TestVaultCAProvider_SecondaryActiveIntermediate (t * testing.T ) {
41
39
t .Parallel ()
42
40
43
- skipIfVaultNotPresent (t )
41
+ SkipIfVaultNotPresent (t )
44
42
45
43
provider , testVault := testVaultProviderWithConfig (t , false , nil )
46
44
defer testVault .Stop ()
@@ -53,7 +51,7 @@ func TestVaultCAProvider_SecondaryActiveIntermediate(t *testing.T) {
53
51
54
52
func TestVaultCAProvider_RenewToken (t * testing.T ) {
55
53
t .Parallel ()
56
- skipIfVaultNotPresent (t )
54
+ SkipIfVaultNotPresent (t )
57
55
58
56
testVault , err := runTestVault (t )
59
57
require .NoError (t , err )
@@ -90,7 +88,7 @@ func TestVaultCAProvider_RenewToken(t *testing.T) {
90
88
func TestVaultCAProvider_Bootstrap (t * testing.T ) {
91
89
t .Parallel ()
92
90
93
- skipIfVaultNotPresent (t )
91
+ SkipIfVaultNotPresent (t )
94
92
95
93
provider , testVault := testVaultProvider (t )
96
94
defer testVault .Stop ()
@@ -151,7 +149,7 @@ func assertCorrectKeyType(t *testing.T, want, certPEM string) {
151
149
func TestVaultCAProvider_SignLeaf (t * testing.T ) {
152
150
t .Parallel ()
153
151
154
- skipIfVaultNotPresent (t )
152
+ SkipIfVaultNotPresent (t )
155
153
156
154
for _ , tc := range KeyTestCases {
157
155
tc := tc
@@ -235,7 +233,7 @@ func TestVaultCAProvider_SignLeaf(t *testing.T) {
235
233
func TestVaultCAProvider_CrossSignCA (t * testing.T ) {
236
234
t .Parallel ()
237
235
238
- skipIfVaultNotPresent (t )
236
+ SkipIfVaultNotPresent (t )
239
237
240
238
tests := CASigningKeyTypeCases ()
241
239
@@ -290,7 +288,7 @@ func TestVaultCAProvider_CrossSignCA(t *testing.T) {
290
288
func TestVaultProvider_SignIntermediate (t * testing.T ) {
291
289
t .Parallel ()
292
290
293
- skipIfVaultNotPresent (t )
291
+ SkipIfVaultNotPresent (t )
294
292
295
293
tests := CASigningKeyTypeCases ()
296
294
@@ -319,7 +317,7 @@ func TestVaultProvider_SignIntermediate(t *testing.T) {
319
317
func TestVaultProvider_SignIntermediateConsul (t * testing.T ) {
320
318
t .Parallel ()
321
319
322
- skipIfVaultNotPresent (t )
320
+ SkipIfVaultNotPresent (t )
323
321
324
322
// primary = Vault, secondary = Consul
325
323
t .Run ("pri=vault,sec=consul" , func (t * testing.T ) {
@@ -441,19 +439,3 @@ func createVaultProvider(t *testing.T, isPrimary bool, addr, token string, rawCo
441
439
442
440
return provider , nil
443
441
}
444
-
445
- // skipIfVaultNotPresent skips the test if the vault binary is not in PATH.
446
- //
447
- // These tests may be skipped in CI. They are run as part of a separate
448
- // integration test suite.
449
- func skipIfVaultNotPresent (t * testing.T ) {
450
- vaultBinaryName := os .Getenv ("VAULT_BINARY_NAME" )
451
- if vaultBinaryName == "" {
452
- vaultBinaryName = "vault"
453
- }
454
-
455
- path , err := exec .LookPath (vaultBinaryName )
456
- if err != nil || path == "" {
457
- t .Skipf ("%q not found on $PATH - download and install to run this test" , vaultBinaryName )
458
- }
459
- }
0 commit comments