Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions internal/cmd/role/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestRole_GetCmdIncludesStatusAndExpiration(t *testing.T) {
"expires_at": "2026-08-20T12:00:00Z",
"password": "",
"access_host_url": "pg.psdb.cloud",
"database_url": "postgresql://app-user:@pg.psdb.cloud:5432/postgres?sslmode=verify-full",
"database_url": "postgresql://app-user:@pg.psdb.cloud:5432/postgres?sslmode=verify-full&sslrootcert=system",
"with_replication": false,
})
}
Expand All @@ -84,7 +84,7 @@ func TestRole_GetCmdConnectionTargets(t *testing.T) {
},
username: "app.branch|replica",
accessHostURL: "primary.pg.psdb.cloud",
databaseURL: "postgresql://app.branch%7Creplica:@primary.pg.psdb.cloud:5432/postgres?sslmode=verify-full",
databaseURL: "postgresql://app.branch%7Creplica:@primary.pg.psdb.cloud:5432/postgres?sslmode=verify-full&sslrootcert=system",
},
{
name: "dedicated read replica",
Expand All @@ -94,7 +94,7 @@ func TestRole_GetCmdConnectionTargets(t *testing.T) {
},
username: "app.read-only|replica",
accessHostURL: "analytics.pg.psdb.cloud",
databaseURL: "postgresql://app.read-only%7Creplica:@analytics.pg.psdb.cloud:5432/postgres?sslmode=verify-full",
databaseURL: "postgresql://app.read-only%7Creplica:@analytics.pg.psdb.cloud:5432/postgres?sslmode=verify-full&sslrootcert=system",
},
{
name: "deprecated read-only replica alias",
Expand All @@ -104,7 +104,7 @@ func TestRole_GetCmdConnectionTargets(t *testing.T) {
},
username: "app.read-only|replica",
accessHostURL: "analytics.pg.psdb.cloud",
databaseURL: "postgresql://app.read-only%7Creplica:@analytics.pg.psdb.cloud:5432/postgres?sslmode=verify-full",
databaseURL: "postgresql://app.read-only%7Creplica:@analytics.pg.psdb.cloud:5432/postgres?sslmode=verify-full&sslrootcert=system",
},
{
name: "bouncer",
Expand All @@ -114,7 +114,7 @@ func TestRole_GetCmdConnectionTargets(t *testing.T) {
},
username: "app.branch|pool",
accessHostURL: "primary.pg.psdb.cloud",
databaseURL: "postgresql://app.branch%7Cpool:@primary.pg.psdb.cloud:6432/postgres?sslmode=verify-full",
databaseURL: "postgresql://app.branch%7Cpool:@primary.pg.psdb.cloud:6432/postgres?sslmode=verify-full&sslrootcert=system",
},
}

Expand Down Expand Up @@ -226,7 +226,7 @@ func TestRole_GetCmdNekiConnectionTargets(t *testing.T) {
Router: "default",
},
username: "app.branch|default",
databaseURL: "postgresql://app.branch%7Cdefault:@pg.psdb.cloud:5432/postgres?sslmode=verify-full",
databaseURL: "postgresql://app.branch%7Cdefault:@pg.psdb.cloud:5432/postgres?sslmode=verify-full&sslrootcert=system",
},
{
name: "replica",
Expand All @@ -236,7 +236,7 @@ func TestRole_GetCmdNekiConnectionTargets(t *testing.T) {
},
username: "app.branch",
options: "-c __neki.target=REPLICA",
databaseURL: "postgresql://app.branch:@pg.psdb.cloud:5432/postgres?sslmode=verify-full&options=-c%20__neki.target=REPLICA",
databaseURL: "postgresql://app.branch:@pg.psdb.cloud:5432/postgres?sslmode=verify-full&sslrootcert=system&options=-c%20__neki.target=REPLICA",
},
{
name: "shard",
Expand All @@ -246,7 +246,7 @@ func TestRole_GetCmdNekiConnectionTargets(t *testing.T) {
},
username: "app.branch",
options: "-c __neki.shard=shzabc",
databaseURL: "postgresql://app.branch:@pg.psdb.cloud:5432/postgres?sslmode=verify-full&options=-c%20__neki.shard=shzabc",
databaseURL: "postgresql://app.branch:@pg.psdb.cloud:5432/postgres?sslmode=verify-full&sslrootcert=system&options=-c%20__neki.shard=shzabc",
},
{
name: "replica shard and router",
Expand All @@ -258,7 +258,7 @@ func TestRole_GetCmdNekiConnectionTargets(t *testing.T) {
},
username: "app.branch|default",
options: "-c __neki.target=REPLICA -c __neki.shard=shzabc",
databaseURL: "postgresql://app.branch%7Cdefault:@pg.psdb.cloud:5432/postgres?sslmode=verify-full&options=-c%20__neki.target=REPLICA%20-c%20__neki.shard=shzabc",
databaseURL: "postgresql://app.branch%7Cdefault:@pg.psdb.cloud:5432/postgres?sslmode=verify-full&sslrootcert=system&options=-c%20__neki.target=REPLICA%20-c%20__neki.shard=shzabc",
},
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/role/reset_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func buildRoleConnectionURL(username, password, accessHostURL, defaultPort, opti
port = defaultPort
}

conn := fmt.Sprintf("postgresql://%s:%s@%s:%s/postgres?sslmode=verify-full",
conn := fmt.Sprintf("postgresql://%s:%s@%s:%s/postgres?sslmode=verify-full&sslrootcert=system",
url.PathEscape(username),
url.PathEscape(password),
host,
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/role/reset_default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestResetDefaultCmd(t *testing.T) {
"expires_at": nil,
"password": "new-password-123",
"access_host_url": "pg.psdb.cloud",
"database_url": "postgresql://postgres:new-password-123@pg.psdb.cloud:5432/postgres?sslmode=verify-full",
"database_url": "postgresql://postgres:new-password-123@pg.psdb.cloud:5432/postgres?sslmode=verify-full&sslrootcert=system",
"with_replication": false,
}
c.Assert(buf.String(), qt.JSONEquals, expectedOutput)
Expand Down
Loading