mirror of
https://github.com/external-secrets/external-secrets.git
synced 2024-12-14 11:57:59 +00:00
fix: make vault provider return NoSecretErr to respect deletionPolicy (#2455)
relates to #1512 #1502 Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>
This commit is contained in:
parent
45aa382fc5
commit
69fe93ea49
2 changed files with 17 additions and 1 deletions
|
@ -707,7 +707,7 @@ func (v *client) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretData
|
||||||
|
|
||||||
// Return nil if secret value is null
|
// Return nil if secret value is null
|
||||||
if data == nil {
|
if data == nil {
|
||||||
return nil, nil
|
return nil, esv1beta1.NoSecretError{}
|
||||||
}
|
}
|
||||||
jsonStr, err := json.Marshal(data)
|
jsonStr, err := json.Marshal(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -632,6 +632,22 @@ func TestGetSecret(t *testing.T) {
|
||||||
val: []byte("something different"),
|
val: []byte("something different"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"ReadSecretWithMissingValueFromData": {
|
||||||
|
reason: "Should return a NoSecretErr",
|
||||||
|
args: args{
|
||||||
|
store: makeValidSecretStoreWithVersion(esv1beta1.VaultKVStoreV1).Spec.Provider.Vault,
|
||||||
|
data: esv1beta1.ExternalSecretDataRemoteRef{
|
||||||
|
Property: "not-relevant",
|
||||||
|
},
|
||||||
|
vLogical: &fake.Logical{
|
||||||
|
ReadWithDataWithContextFn: fake.NewReadWithContextFn(nil, nil),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
want: want{
|
||||||
|
err: esv1beta1.NoSecretErr,
|
||||||
|
val: nil,
|
||||||
|
},
|
||||||
|
},
|
||||||
"ReadSecretWithSliceValue": {
|
"ReadSecretWithSliceValue": {
|
||||||
reason: "Should return property as a joined slice",
|
reason: "Should return property as a joined slice",
|
||||||
args: args{
|
args: args{
|
||||||
|
|
Loading…
Reference in a new issue