Skip to content

Commit

Permalink
Allow empty objects array
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekin Dursun committed Oct 8, 2021
1 parent 875baee commit f3c5b38
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pkg/provider/provider.go
Expand Up @@ -257,7 +257,7 @@ func (p *Provider) MountSecretsStoreObjectContent(ctx context.Context, attrib ma
klog.InfoS("unmarshaled key vault objects", "keyVaultObjects", keyVaultObjects, "count", len(keyVaultObjects), "pod", klog.ObjectRef{Namespace: podNamespace, Name: podName})

if len(keyVaultObjects) == 0 {
return nil, nil, fmt.Errorf("objects array is empty")
return make(map[string][]byte), make(map[string]string), nil
}

vaultURL, err := mc.getVaultURL()
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/provider_test.go
Expand Up @@ -768,7 +768,7 @@ func TestMountSecretsStoreObjectContent(t *testing.T) {
"objects": `
array:`,
},
expectedErr: true,
expectedErr: false,
},
{
desc: "invalid object format",
Expand Down
9 changes: 0 additions & 9 deletions pkg/server/server_test.go
Expand Up @@ -35,15 +35,6 @@ func TestMount(t *testing.T) {
},
expectedErr: true,
},
{
desc: "failed to mount request",
mountRequest: &v1alpha1.MountRequest{
Attributes: `{"keyvaultName":"kv","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objects": "array:"}`,
Secrets: `{"clientid":"foo","clientsecret":"bar"}`,
Permission: "420",
},
expectedErr: true,
},
}

for _, tc := range cases {
Expand Down

0 comments on commit f3c5b38

Please sign in to comment.