Merge branch 'master' into upgrade_redis_client_to_v8

This commit is contained in:
Artur Souza 2021-04-28 12:49:48 -07:00 committed by GitHub
commit 3823e43f1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View File

@ -87,7 +87,7 @@ func (v *vaultSecretStore) Init(metadata secretstores.Metadata) error {
// Get Vault address
address := props[componentVaultAddress]
if address == "" {
v.vaultAddress = defaultVaultAddress
address = defaultVaultAddress
}
v.vaultAddress = address

View File

@ -84,6 +84,31 @@ func TestVaultTLSConfig(t *testing.T) {
})
}
func TestDefaultVaultAddress(t *testing.T) {
t.Run("with blank vaultAddr", func(t *testing.T) {
properties := map[string]string{
"vaultTokenMountPath": "./vault.txt",
}
m := secretstores.Metadata{
Properties: properties,
}
target := &vaultSecretStore{
client: nil,
logger: nil,
}
// This call will throw an error on Windows systems because of the of
// the call x509.SystemCertPool() because system root pool is not
// available on Windows so ignore the error for when the tests are run
// on the Windows platform during CI
_ = target.Init(m)
assert.Equal(t, defaultVaultAddress, target.vaultAddress, "default was not set")
})
}
func getCertificate() []byte {
certificateBytes, _ := base64.StdEncoding.DecodeString(certificate)