Skip to content

Commit

Permalink
PMM-12551 Fix for new connection string format.
Browse files Browse the repository at this point in the history
  • Loading branch information
JiriCtvrtka committed Mar 21, 2024
1 parent 05c74f6 commit 2d55e0b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion managed/services/telemetry/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestRunTelemetryService(t *testing.T) {
if ok {
pgHostPort = pgHostPortFromEnv
}
qanDSN := "tcp://localhost:9000?database=pmm"
qanDSN := "tcp://localhost:9000/pmm"
qanDSNFromEnv, ok := os.LookupEnv(envQanDSN)
if ok {
qanDSN = qanDSNFromEnv
Expand Down
8 changes: 4 additions & 4 deletions qan-api2/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ func setup() *sqlx.DB {
}

dsn, ok := os.LookupEnv("QANAPI_DSN_TEST")
dsn = strings.Replace(dsn, "?database=pmm_test", "?database=pmm_test_parts", 1)
dsn = strings.Replace(dsn, "/pmm_test", "/pmm_test_parts", 1)
if !ok {
dsn = "clickhouse://127.0.0.1:19000?database=pmm_test_parts"
dsn = "clickhouse://127.0.0.1:19000/pmm_test_parts"
}
db, err := sqlx.Connect("clickhouse", dsn)
if err != nil {
Expand Down Expand Up @@ -113,9 +113,9 @@ func TestCreateDbIfNotExists(t *testing.T) {
t.Run("connect to db that doesnt exist", func(t *testing.T) {
dsn, ok := os.LookupEnv("QANAPI_DSN_TEST")

dsn = strings.Replace(dsn, "?database=pmm_test", "?database=pmm_created_db", 1)
dsn = strings.Replace(dsn, "/pmm_test", "/pmm_created_db", 1)
if !ok {
dsn = "clickhouse://127.0.0.1:19000?database=pmm_created_db"
dsn = "clickhouse://127.0.0.1:19000/pmm_created_db"
}

db := createDB(dsn)
Expand Down
2 changes: 1 addition & 1 deletion qan-api2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import (

const (
shutdownTimeout = 3 * time.Second
defaultDsnF = "clickhouse://%s?database=%s&block_size=%s&pool_size=%s"
defaultDsnF = "clickhouse://%s/%s?block_size=%s&pool_size=%s"
maxIdleConns = 5
maxOpenConns = 10
)
Expand Down
2 changes: 1 addition & 1 deletion qan-api2/services/analytics/filters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type testValuesUnmarshal struct {
func TestService_GetFilters(t *testing.T) {
dsn, ok := os.LookupEnv("QANAPI_DSN_TEST")
if !ok {
dsn = "clickhouse://127.0.0.1:19000?database=pmm_test"
dsn = "clickhouse://127.0.0.1:19000/pmm_test"
}
db, err := sqlx.Connect("clickhouse", dsn)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion qan-api2/services/analytics/profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
func setup() *sqlx.DB {
dsn, ok := os.LookupEnv("QANAPI_DSN_TEST")
if !ok {
dsn = "clickhouse://127.0.0.1:19000?database=pmm_test"
dsn = "clickhouse://127.0.0.1:19000/pmm_test"
}
db, err := sqlx.Connect("clickhouse", dsn)
if err != nil {
Expand Down

0 comments on commit 2d55e0b

Please sign in to comment.