Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
greedy52 committed Nov 23, 2024
1 parent 3617fe1 commit 9a1609e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion api/types/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func (s *IntegrationSpecV1_AzureOIDC) Validate() error {
// CheckAndSetDefaults validates the configuration for GitHub integration subkind.
func (s *IntegrationSpecV1_GitHub) CheckAndSetDefaults() error {
if s == nil || s.GitHub == nil {
return trace.BadParameter("github spec must be set for GitHub integrations", IntegrationSubKindGitHub)
return trace.BadParameter("github spec must be set for GitHub integrations")
}
if err := ValidateGitHubOrganizationName(s.GitHub.Organization); err != nil {
return trace.Wrap(err, "invalid GitHub organization name")
Expand Down Expand Up @@ -522,6 +522,10 @@ func (ig *IntegrationV1) SetCredentials(creds PluginCredentials) error {

// GetCredentials retrieves credentials.
func (ig *IntegrationV1) GetCredentials() PluginCredentials {
// This function returns an interface so return nil explicitly.
if ig.Spec.Credentials == nil {
return nil
}
return ig.Spec.Credentials
}

Expand Down
5 changes: 3 additions & 2 deletions lib/auth/integration/integrationv1/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ import (
"maps"

"github.com/google/uuid"
"github.com/gravitational/trace"

"github.com/gravitational/teleport/api/types"
"github.com/gravitational/teleport/lib/cryptosuites"
"github.com/gravitational/trace"
)

const (
Expand Down Expand Up @@ -223,5 +224,5 @@ func (s *Service) removeStaticCredentials(ctx context.Context, ig types.Integrat
errors = append(errors, err)
}
}
return trace.NewAggregate(err)
return trace.NewAggregate(errors...)
}

0 comments on commit 9a1609e

Please sign in to comment.