refact(e2e): Create vault-generic credential library helper method (#4437)

* refact(e2e): Create vault-generic credential library helper method

* fixup! refact(e2e): Create vault-generic credential library helper method
This commit is contained in:
Michael Li authored and GitHub committed 2024-02-23 15:46:11 -05:00
1 parent 3856573eeb
commit fee2b99ade
8 files changed
+92 -132

No files matched your search

@@ -10,7 +10,6 @@ import (
"strings"
"testing"
"github.com/hashicorp/boundary/api/credentiallibraries"
"github.com/hashicorp/boundary/internal/target"
"github.com/hashicorp/boundary/testing/internal/e2e"
"github.com/hashicorp/boundary/testing/internal/e2e/boundary"
@@ -98,22 +97,14 @@ func TestCliTcpTargetWorkerConnectTarget(t *testing.T) {
newCredentialStoreId := boundary.CreateNewCredentialStoreVaultCli(t, ctx, newProjectId, c.VaultAddr, credStoreToken)
// Create a credential library
output = e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"credential-libraries", "create", "vault-generic",
"-credential-store-id", newCredentialStoreId,
"-vault-path", fmt.Sprintf("%s/data/%s", c.VaultSecretPath, privateKeySecretName),
"-name", "e2e Automated Test Vault Credential Library",
"-credential-type", "ssh_private_key",
"-format", "json",
),
newCredentialLibraryId, err := boundary.CreateVaultGenericCredentialLibraryCli(
t,
ctx,
newCredentialStoreId,
fmt.Sprintf("%s/data/%s", c.VaultSecretPath, privateKeySecretName),
"ssh_private_key",
)
require.NoError(t, output.Err, string(output.Stderr))
var newCredentialLibraryResult credentiallibraries.CredentialLibraryCreateResult
err = json.Unmarshal(output.Stdout, &newCredentialLibraryResult)
require.NoError(t, err)
newCredentialLibraryId := newCredentialLibraryResult.Item.Id
t.Logf("Created Credential Library: %s", newCredentialLibraryId)
// Try to set a worker filter on a vault credential-store
output = e2e.RunCommand(ctx, "boundary",