refact(e2e): Update RunCommand to have context argument
This commit is contained in:
1 parent
84aa65ccc5
commit
a4e27d877d
12 files changed
+64
-76
No files matched your search
@@ -63,12 +63,13 @@ func TestCreateVaultCredentialStoreCli(t *testing.T) {
|
||||
boundary.AddHostSourceToTargetCli(t, newTargetId, newHostSetId)
|
||||
|
||||
// Configure vault
|
||||
ctx := context.Background()
|
||||
vaultAddr, boundaryPolicyName := vault.Setup(t)
|
||||
|
||||
output := e2e.RunCommand("vault", "secrets", "enable", "-path="+c.VaultSecretPath, "kv-v2")
|
||||
output := e2e.RunCommand(ctx, "vault", "secrets", "enable", "-path="+c.VaultSecretPath, "kv-v2")
|
||||
require.NoError(t, output.Err, string(output.Stderr))
|
||||
t.Cleanup(func() {
|
||||
output := e2e.RunCommand("vault", "secrets", "disable", c.VaultSecretPath)
|
||||
output := e2e.RunCommand(ctx, "vault", "secrets", "disable", c.VaultSecretPath)
|
||||
require.NoError(t, output.Err, string(output.Stderr))
|
||||
})
|
||||
|
||||
@@ -78,7 +79,7 @@ func TestCreateVaultCredentialStoreCli(t *testing.T) {
|
||||
t.Log("Created Vault Credential")
|
||||
|
||||
// Create vault token for boundary
|
||||
output = e2e.RunCommand("vault", "token", "create",
|
||||
output = e2e.RunCommand(ctx, "vault", "token", "create",
|
||||
"-no-default-policy=true",
|
||||
"-policy="+boundaryPolicyName,
|
||||
"-policy="+credentialPolicyName,
|
||||
@@ -95,7 +96,7 @@ func TestCreateVaultCredentialStoreCli(t *testing.T) {
|
||||
t.Log("Created Vault Cred Store Token")
|
||||
|
||||
// Create a credential store
|
||||
output = e2e.RunCommand("boundary", "credential-stores", "create", "vault",
|
||||
output = e2e.RunCommand(ctx, "boundary", "credential-stores", "create", "vault",
|
||||
"-scope-id", newProjectId,
|
||||
"-vault-address", vaultAddr,
|
||||
"-vault-token", credStoreToken,
|
||||
@@ -109,7 +110,7 @@ func TestCreateVaultCredentialStoreCli(t *testing.T) {
|
||||
t.Logf("Created Credential Store: %s", newCredentialStoreId)
|
||||
|
||||
// Create a credential library
|
||||
output = e2e.RunCommand("boundary", "credential-libraries", "create", "vault",
|
||||
output = e2e.RunCommand(ctx, "boundary", "credential-libraries", "create", "vault",
|
||||
"-credential-store-id", newCredentialStoreId,
|
||||
"-vault-path", c.VaultSecretPath+"/data/"+secretName,
|
||||
"-name", "e2e Automated Test Vault Credential Library",
|
||||
@@ -124,14 +125,14 @@ func TestCreateVaultCredentialStoreCli(t *testing.T) {
|
||||
t.Logf("Created Credential Library: %s", newCredentialLibraryId)
|
||||
|
||||
// Add brokered credentials to target
|
||||
output = e2e.RunCommand("boundary", "targets", "add-credential-sources",
|
||||
output = e2e.RunCommand(ctx, "boundary", "targets", "add-credential-sources",
|
||||
"-id", newTargetId,
|
||||
"-brokered-credential-source", newCredentialLibraryId,
|
||||
)
|
||||
require.NoError(t, output.Err, string(output.Stderr))
|
||||
|
||||
// Get credentials for target
|
||||
output = e2e.RunCommand("boundary", "targets", "authorize-session", "-id", newTargetId, "-format", "json")
|
||||
output = e2e.RunCommand(ctx, "boundary", "targets", "authorize-session", "-id", newTargetId, "-format", "json")
|
||||
require.NoError(t, output.Err, string(output.Stderr))
|
||||
var newSessionAuthorizationResult targets.SessionAuthorizationResult
|
||||
err = json.Unmarshal(output.Stdout, &newSessionAuthorizationResult)
|
||||
@@ -157,7 +158,7 @@ func TestCreateVaultCredentialStoreCli(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// Connect to target and print host's IP address using retrieved credentials
|
||||
output = e2e.RunCommand("boundary", "connect",
|
||||
output = e2e.RunCommand(ctx, "boundary", "connect",
|
||||
"-target-id", newTargetId,
|
||||
"-exec", "/usr/bin/ssh", "--",
|
||||
"-l", retrievedUser,
|
||||
@@ -201,10 +202,10 @@ func TestCreateVaultCredentialStoreApi(t *testing.T) {
|
||||
// Configure vault
|
||||
vaultAddr, boundaryPolicyName := vault.Setup(t)
|
||||
|
||||
output := e2e.RunCommand("vault", "secrets", "enable", "-path="+c.VaultSecretPath, "kv-v2")
|
||||
output := e2e.RunCommand(ctx, "vault", "secrets", "enable", "-path="+c.VaultSecretPath, "kv-v2")
|
||||
require.NoError(t, output.Err, string(output.Stderr))
|
||||
t.Cleanup(func() {
|
||||
output := e2e.RunCommand("vault", "secrets", "disable", c.VaultSecretPath)
|
||||
output := e2e.RunCommand(ctx, "vault", "secrets", "disable", c.VaultSecretPath)
|
||||
require.NoError(t, output.Err, string(output.Stderr))
|
||||
})
|
||||
|
||||
@@ -214,7 +215,7 @@ func TestCreateVaultCredentialStoreApi(t *testing.T) {
|
||||
t.Log("Created Vault Credential")
|
||||
|
||||
// Create vault token for boundary
|
||||
output = e2e.RunCommand("vault", "token", "create",
|
||||
output = e2e.RunCommand(ctx, "vault", "token", "create",
|
||||
"-no-default-policy=true",
|
||||
"-policy="+boundaryPolicyName,
|
||||
"-policy="+credentialPolicyName,
|
||||
|
||||
Reference in new issue
Block a user