Skip to content

Commit

Permalink
fix: Fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Kim Christensen <kimworking@gmail.com>
  • Loading branch information
kichristensen committed Jan 2, 2025
1 parent d791029 commit be69c9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions pkg/cnab/provider/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ func (r *Runtime) loadCredentials(ctx context.Context, b cnab.ExtendedBundle, ru
return span.Error(err)
}

for _, key := range run.Credentials.Keys() {
cred, ok := run.Credentials.GetCredential(key)
if !ok {
return span.Errorf("credential %s not found", key)
for i, cred := range run.Credentials.Credentials {
if resolvedValue, ok := resolvedCredentials[cred.Name]; ok {
run.Credentials.Credentials[i].ResolvedValue = resolvedValue
}
cred.ResolvedValue = resolvedCredentials[key]
}

err = run.Credentials.ValidateBundle(b.Credentials, run.Action)
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/credentialset.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (s CredentialSet) ValidateBundle(spec map[string]bundle.Credential, action

// Keys returns the names of all the credentials in the set.
func (s CredentialSet) Keys() []string {
keys := make([]string, len(s.Credentials))
keys := make([]string, 0, len(s.Credentials))
for _, cred := range s.Credentials {
keys = append(keys, cred.Name)
}
Expand Down

0 comments on commit be69c9d

Please sign in to comment.