fix(tests): update database host from localhost to 127.0.0.1
Integration Tests / integration-test (push) Failing after 1m15s
Integration Tests / integration-test (push) Failing after 1m15s
* Adjust connection strings in integration tests for consistency * Ensure compatibility with CI environments that use IPv4
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func TestConnection(t *testing.T) {
|
||||
connStr := "user=user password=password dbname=broker_test port=5433 sslmode=disable"
|
||||
connStr := "user=user password=password dbname=broker_test host=127.0.0.1 port=5433 sslmode=disable"
|
||||
var db *sql.DB
|
||||
var err error
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ func TestRLSTenantIsolation(t *testing.T) {
|
||||
}
|
||||
|
||||
runtimeDB, err := sql.Open("postgres",
|
||||
"user=test_broker_runtime password=test-pass dbname=broker_test host=localhost port=5433 sslmode=disable options='-c search_path=broker,public'")
|
||||
"user=test_broker_runtime password=test-pass dbname=broker_test host=127.0.0.1 port=5433 sslmode=disable options='-c search_path=broker,public'")
|
||||
require.NoError(t, err)
|
||||
defer runtimeDB.Close()
|
||||
require.NoError(t, runtimeDB.Ping())
|
||||
|
||||
@@ -14,11 +14,11 @@ import (
|
||||
"git.warky.dev/wdevs/pgsql-broker/pkg/broker/install"
|
||||
)
|
||||
|
||||
const stage5ConnStr = "user=user password=password dbname=broker_test host=localhost port=5433 sslmode=disable"
|
||||
const stage5ConnStr = "user=user password=password dbname=broker_test host=127.0.0.1 port=5433 sslmode=disable"
|
||||
|
||||
func newStage5Adapter(logger adapter.Logger) *adapter.PostgresAdapter {
|
||||
return adapter.NewPostgresAdapter(adapter.PostgresConfig{
|
||||
Host: "localhost", Port: 5433, Database: "broker_test",
|
||||
Host: "127.0.0.1", Port: 5433, Database: "broker_test",
|
||||
User: "user", Password: "password", SSLMode: "disable",
|
||||
MaxOpenConns: 10, MaxIdleConns: 2,
|
||||
ConnMaxLifetime: 5 * time.Minute, ConnMaxIdleTime: 10 * time.Minute,
|
||||
|
||||
@@ -27,7 +27,7 @@ func TestBrokerWorkflow(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
// Database connection string
|
||||
connStr := "user=user password=password dbname=broker_test host=localhost port=5433 sslmode=disable"
|
||||
connStr := "user=user password=password dbname=broker_test host=127.0.0.1 port=5433 sslmode=disable"
|
||||
|
||||
// Connect to database with retry logic
|
||||
db, err := connectWithRetry(connStr, 10, 2*time.Second)
|
||||
@@ -43,7 +43,7 @@ func TestBrokerWorkflow(t *testing.T) {
|
||||
|
||||
// Create database adapter
|
||||
postgresConfig := adapter.PostgresConfig{
|
||||
Host: "localhost",
|
||||
Host: "127.0.0.1",
|
||||
Port: 5433,
|
||||
Database: "broker_test",
|
||||
User: "user",
|
||||
@@ -78,7 +78,7 @@ func TestBrokerWorkflow(t *testing.T) {
|
||||
Databases: []config.DatabaseConfig{
|
||||
{
|
||||
Name: "test_db",
|
||||
Host: "localhost",
|
||||
Host: "127.0.0.1",
|
||||
Port: 5433,
|
||||
Database: "broker_test",
|
||||
User: "user",
|
||||
|
||||
Reference in New Issue
Block a user