testing/e2e: add credential store API helper
This commit is contained in:
1 parent
780dfe20ad
commit
9047d5b22a
1 file changed
+17
@@ -27,6 +27,23 @@ func CreateNewCredentialStoreStaticApi(t testing.TB, ctx context.Context, client
|
||||
return newCredentialStoreId
|
||||
}
|
||||
|
||||
// CreateNewCredentialStoreVaultApi uses the API to create a Vault credential store
|
||||
// Returns the id of the new credential store
|
||||
func CreateNewCredentialStoreVaultApi(t testing.TB, ctx context.Context, client *api.Client, projectId string, vaultAddr string, vaultToken string) string {
|
||||
c := credentialstores.NewClient(client)
|
||||
newCredentialStoreResult, err := c.Create(
|
||||
ctx, "vault", projectId,
|
||||
credentialstores.WithName("e2e Credential Store"),
|
||||
credentialstores.WithVaultCredentialStoreAddress(vaultAddr),
|
||||
credentialstores.WithVaultCredentialStoreToken(vaultToken),
|
||||
)
|
||||
require.NoError(t, err)
|
||||
newVaultCredentialStoreId := newCredentialStoreResult.Item.Id
|
||||
t.Logf("Created Credential Store: %s", newVaultCredentialStoreId)
|
||||
|
||||
return newVaultCredentialStoreId
|
||||
}
|
||||
|
||||
// CreateNewCredentialStoreVaultCli uses the cli to create a Vault credential store
|
||||
// Returns the id of the new credential store
|
||||
func CreateNewCredentialStoreVaultCli(t testing.TB, ctx context.Context, projectId string, vaultAddr string, vaultToken string) string {
|
||||
|
||||
Reference in new issue
Block a user