Skip to content

Commit

Permalink
code quality suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Haydn Evans committed Dec 30, 2024
1 parent dec7e3c commit b205e5f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/scalers/postgresql_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"database/sql"
"fmt"
"net"
"regexp"
"strings"
"time"
Expand Down Expand Up @@ -202,7 +203,7 @@ func getConnection(ctx context.Context, meta *postgreSQLMetadata, podIdentity ke
if err != nil {
return nil, err
}
DBendpoint := fmt.Sprintf("%s:%s", meta.Host, meta.Port)
DBendpoint := net.JoinHostPort(meta.Host, meta.Port)
password, err := auth.BuildAuthToken(ctx, DBendpoint, meta.AwsRegion, meta.UserName, cfg.Credentials)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/postgresql_scaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func TestPodIdentityAzureWorkloadPosgresSQLConnectionStringGeneration(t *testing
func TestPodIdentityAWSWorkloadPosgresSQLConnectionStringGeneration(t *testing.T) {
identityID := "IDENTITY_ID_CORRESPONDING_TO_USERNAME_FIELD"
for _, testData := range testPodIdentityAwsWorkloadPostgresSQLConnectionstring {
meta, _, err := parsePostgreSQLMetadata(logr.Discard(), &scalersconfig.ScalerConfig{ResolvedEnv: testData.resolvedEnv, TriggerMetadata: testData.metadata, PodIdentity: kedav1alpha1.AuthPodIdentity{Provider: kedav1alpha1.PodIdentityProviderAWSWorkload, IdentityID: &identityID}, AuthParams: testData.authParam, TriggerIndex: 0})
meta, _, err := parsePostgreSQLMetadata(logr.Discard(), &scalersconfig.ScalerConfig{ResolvedEnv: testData.resolvedEnv, TriggerMetadata: testData.metadata, PodIdentity: kedav1alpha1.AuthPodIdentity{Provider: kedav1alpha1.PodIdentityProviderAws, IdentityID: &identityID}, AuthParams: testData.authParam, TriggerIndex: 0})
if err != nil {
t.Fatal("Could not parse metadata:", err)
}
Expand Down

0 comments on commit b205e5f

Please sign in to comment.