Documentation
¶
Index ¶
- func SetupAWSSecret(ctx context.Context, t *testing.T, localstack *LocalStackContainer, ...)
- func SetupAllContainers(ctx context.Context, t *testing.T) (*LocalStackContainer, *VaultContainer, *GCSMContainer)
- func SetupAzureKeyVaultSecret(ctx context.Context, t *testing.T, akvContainer *AzureKeyVaultContainer, ...)
- func SetupContainers(ctx context.Context, t *testing.T) (*LocalStackContainer, *VaultContainer)
- func SetupVaultSecret(ctx context.Context, t *testing.T, vaultContainer *VaultContainer, ...)
- func VerifyGCSMSecretExists(ctx context.Context, t *testing.T, gcsmContainer *GCSMContainer, ...)
- type AzureKeyVaultContainer
- type GCSMContainer
- type LocalStackContainer
- type VaultContainer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupAWSSecret ¶
func SetupAWSSecret(ctx context.Context, t *testing.T, localstack *LocalStackContainer, secretName string, secretData map[string]string)
SetupAWSSecret creates a secret in AWS Secrets Manager (LocalStack)
func SetupAllContainers ¶
func SetupAllContainers(ctx context.Context, t *testing.T) (*LocalStackContainer, *VaultContainer, *GCSMContainer)
SetupAllContainers sets up LocalStack, Vault, and GCSM containers
func SetupAzureKeyVaultSecret ¶
func SetupAzureKeyVaultSecret(ctx context.Context, t *testing.T, akvContainer *AzureKeyVaultContainer, secretName string, secretData map[string]interface{})
SetupAzureKeyVaultSecret creates a secret in Azure Key Vault emulator
func SetupContainers ¶
func SetupContainers(ctx context.Context, t *testing.T) (*LocalStackContainer, *VaultContainer)
SetupContainers sets up both LocalStack and Vault containers
func SetupVaultSecret ¶
func SetupVaultSecret(ctx context.Context, t *testing.T, vaultContainer *VaultContainer, vaultPath string, secretData map[string]interface{})
SetupVaultSecret enables KV v2 engine (if needed) and writes a secret to Vault
func VerifyGCSMSecretExists ¶
func VerifyGCSMSecretExists(ctx context.Context, t *testing.T, gcsmContainer *GCSMContainer, projectID, secretID string)
VerifyGCSMSecretExists checks if a secret exists in Google Cloud Secret Manager This is used to verify that predefined secrets are available for testing
Types ¶
type AzureKeyVaultContainer ¶
type AzureKeyVaultContainer struct {
Container testcontainers.Container
VaultURL string
Client *azsecrets.Client
Cleanup func() error
}
AzureKeyVaultContainer wraps Azure Key Vault emulator container and client
func SetupAzureKeyVault ¶
func SetupAzureKeyVault(ctx context.Context, t *testing.T) *AzureKeyVaultContainer
SetupAzureKeyVault starts a Lowkey Vault container Lowkey Vault is a test double for Azure Key Vault that's compatible with Azure Key Vault REST APIs Lowkey Vault is chosen over james-gould emulator because it doesn't require pre-generated SSL certificates, making it much simpler to use in automated test environments
type GCSMContainer ¶
type GCSMContainer struct {
Container testcontainers.Container // nil for real API
Endpoint string // empty for real API
Client *secretmanager.Client
ProjectID string // GCP project ID for real API
Cleanup func() error
}
GCSMContainer wraps GCSM client for real API testing
type LocalStackContainer ¶
type LocalStackContainer struct {
Container *localstack.LocalStackContainer
Endpoint string
Cleanup func() error
}
LocalStackContainer wraps LocalStack container and its endpoint
func SetupLocalStack ¶
func SetupLocalStack(ctx context.Context, t *testing.T) *LocalStackContainer
SetupLocalStack starts a LocalStack container and returns the container info
type VaultContainer ¶
type VaultContainer struct {
Container *vault.VaultContainer
Address string
Client *api.Client
Cleanup func() error
}
VaultContainer wraps Vault container, address, and client
func SetupVault ¶
func SetupVault(ctx context.Context, t *testing.T) *VaultContainer
SetupVault starts a Vault container and returns the container info