34 lines
597 B
Go
34 lines
597 B
Go
package secret
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestAzureKeyVault(t *testing.T) {
|
|
tenant := os.Getenv("AZURE_TENANT_ID")
|
|
if tenant == "" {
|
|
t.Skip("AZURE_TENANT_ID not set, which should contain the tenant ID for testing")
|
|
return
|
|
}
|
|
|
|
vault := os.Getenv("AZURE_KEY_VAULT")
|
|
if vault == "" {
|
|
t.Skip("AZURE_KEY_VAULT not set, which should contain the name of the Key Vault for testing")
|
|
}
|
|
|
|
p, err := AzureKeyVault(tenant, vault)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
return
|
|
}
|
|
|
|
v, err := p.GetSecret("test-integration")
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
|
|
t.Logf("secret: %q", v)
|
|
}
|