fix(tests): update database connection strings for CI
Integration Tests / integration-test (push) Failing after 57s
Integration Tests / integration-test (push) Failing after 57s
* Use dynamic host and port for Postgres in tests * Add helper functions for test database host and port
This commit is contained in:
@@ -3,6 +3,7 @@ package integration
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -27,7 +28,7 @@ func TestBrokerWorkflow(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
// Database connection string
|
||||
connStr := "user=user password=password dbname=broker_test host=127.0.0.1 port=5433 sslmode=disable"
|
||||
connStr := fmt.Sprintf("user=user password=password dbname=broker_test host=%s port=%d sslmode=disable", testDBHost(), testDBPort())
|
||||
|
||||
// Connect to database with retry logic
|
||||
db, err := connectWithRetry(connStr, 10, 2*time.Second)
|
||||
@@ -43,8 +44,8 @@ func TestBrokerWorkflow(t *testing.T) {
|
||||
|
||||
// Create database adapter
|
||||
postgresConfig := adapter.PostgresConfig{
|
||||
Host: "127.0.0.1",
|
||||
Port: 5433,
|
||||
Host: testDBHost(),
|
||||
Port: testDBPort(),
|
||||
Database: "broker_test",
|
||||
User: "user",
|
||||
Password: "password",
|
||||
@@ -78,8 +79,8 @@ func TestBrokerWorkflow(t *testing.T) {
|
||||
Databases: []config.DatabaseConfig{
|
||||
{
|
||||
Name: "test_db",
|
||||
Host: "127.0.0.1",
|
||||
Port: 5433,
|
||||
Host: testDBHost(),
|
||||
Port: testDBPort(),
|
||||
Database: "broker_test",
|
||||
User: "user",
|
||||
Password: "password",
|
||||
|
||||
Reference in New Issue
Block a user