diff --git a/maintnotifications/e2e/scenario_endpoint_types_test.go b/maintnotifications/e2e/scenario_endpoint_types_test.go index 0f3e6c73..57bd9439 100644 --- a/maintnotifications/e2e/scenario_endpoint_types_test.go +++ b/maintnotifications/e2e/scenario_endpoint_types_test.go @@ -24,14 +24,6 @@ func TestEndpointTypesPushNotifications(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 25*time.Minute) defer cancel() - // Setup: Create fresh database and client factory for this test - bdbID, factory, cleanup := SetupTestDatabaseAndFactory(t, ctx, "standalone") - defer cleanup() - t.Logf("[ENDPOINT-TYPES] Created test database with bdb_id: %d", bdbID) - - // Wait for database to be fully ready - time.Sleep(10 * time.Second) - var dump = true var errorsDetected = false @@ -62,26 +54,29 @@ func TestEndpointTypesPushNotifications(t *testing.T) { logCollector.Clear() }() - // Create fault injector - faultInjector, err := CreateTestFaultInjector() - if err != nil { - t.Fatalf("[ERROR] Failed to create fault injector: %v", err) - } - - // Get endpoint config from factory (now connected to new database) - endpointConfig := factory.GetConfig() - - defer func() { - if dump { - fmt.Println("Pool stats:") - factory.PrintPoolStats(t) - } - // Note: factory.DestroyAll() is called by cleanup() function - }() - - // Test each endpoint type + // Test each endpoint type with its own fresh database for _, endpointTest := range endpointTypes { t.Run(endpointTest.name, func(t *testing.T) { + // Setup: Create fresh database and client factory for THIS endpoint type test + bdbID, factory, cleanup := SetupTestDatabaseAndFactory(t, ctx, "standalone") + defer cleanup() + t.Logf("[ENDPOINT-TYPES-%s] Created test database with bdb_id: %d", endpointTest.name, bdbID) + + // Create fault injector + faultInjector, err := CreateTestFaultInjector() + if err != nil { + t.Fatalf("[ERROR] Failed to create fault injector: %v", err) + } + + // Get endpoint config from factory (now connected to new database) + endpointConfig := factory.GetConfig() + + defer func() { + if dump { + fmt.Println("Pool stats:") + factory.PrintPoolStats(t) + } + }() // Clear logs between endpoint type tests logCollector.Clear() // reset errors detected flag diff --git a/maintnotifications/e2e/scenario_timeout_configs_test.go b/maintnotifications/e2e/scenario_timeout_configs_test.go index dca47877..ae7fcdb0 100644 --- a/maintnotifications/e2e/scenario_timeout_configs_test.go +++ b/maintnotifications/e2e/scenario_timeout_configs_test.go @@ -22,14 +22,6 @@ func TestTimeoutConfigurationsPushNotifications(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute) defer cancel() - // Setup: Create fresh database and client factory for this test - bdbID, factory, cleanup := SetupTestDatabaseAndFactory(t, ctx, "standalone") - defer cleanup() - t.Logf("[TIMEOUT-CONFIGS] Created test database with bdb_id: %d", bdbID) - - // Wait for database to be fully ready - time.Sleep(10 * time.Second) - var dump = true var errorsDetected = false @@ -82,26 +74,30 @@ func TestTimeoutConfigurationsPushNotifications(t *testing.T) { logCollector.Clear() }() - // Get endpoint config from factory (now connected to new database) - endpointConfig := factory.GetConfig() - - // Create fault injector - faultInjector, err := CreateTestFaultInjector() - if err != nil { - t.Fatalf("[ERROR] Failed to create fault injector: %v", err) - } - - defer func() { - if dump { - p("Pool stats:") - factory.PrintPoolStats(t) - } - // Note: factory.DestroyAll() is called by cleanup() function - }() - - // Test each timeout configuration + // Test each timeout configuration with its own fresh database for _, timeoutTest := range timeoutConfigs { t.Run(timeoutTest.name, func(t *testing.T) { + // Setup: Create fresh database and client factory for THIS timeout config test + bdbID, factory, cleanup := SetupTestDatabaseAndFactory(t, ctx, "standalone") + defer cleanup() + t.Logf("[TIMEOUT-CONFIGS-%s] Created test database with bdb_id: %d", timeoutTest.name, bdbID) + + // Get endpoint config from factory (now connected to new database) + endpointConfig := factory.GetConfig() + + // Create fault injector + faultInjector, err := CreateTestFaultInjector() + if err != nil { + t.Fatalf("[ERROR] Failed to create fault injector: %v", err) + } + + defer func() { + if dump { + p("Pool stats:") + factory.PrintPoolStats(t) + } + }() + errorsDetected = false var ef = func(format string, args ...interface{}) { printLog("TIMEOUT-CONFIGS", true, format, args...) diff --git a/maintnotifications/e2e/scenario_tls_configs_test.go b/maintnotifications/e2e/scenario_tls_configs_test.go index b451633e..243ea3b7 100644 --- a/maintnotifications/e2e/scenario_tls_configs_test.go +++ b/maintnotifications/e2e/scenario_tls_configs_test.go @@ -23,14 +23,6 @@ func ТestTLSConfigurationsPushNotifications(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 25*time.Minute) defer cancel() - // Setup: Create fresh database and client factory for this test - bdbID, factory, cleanup := SetupTestDatabaseAndFactory(t, ctx, "standalone") - defer cleanup() - t.Logf("[TLS-CONFIGS] Created test database with bdb_id: %d", bdbID) - - // Wait for database to be fully ready - time.Sleep(10 * time.Second) - var dump = true var errorsDetected = false var p = func(format string, args ...interface{}) { @@ -78,26 +70,30 @@ func ТestTLSConfigurationsPushNotifications(t *testing.T) { logCollector.Clear() }() - // Get endpoint config from factory (now connected to new database) - endpointConfig := factory.GetConfig() - - // Create fault injector - faultInjector, err := CreateTestFaultInjector() - if err != nil { - t.Fatalf("[ERROR] Failed to create fault injector: %v", err) - } - - defer func() { - if dump { - p("Pool stats:") - factory.PrintPoolStats(t) - } - // Note: factory.DestroyAll() is called by cleanup() function - }() - - // Test each TLS configuration + // Test each TLS configuration with its own fresh database for _, tlsTest := range tlsConfigs { t.Run(tlsTest.name, func(t *testing.T) { + // Setup: Create fresh database and client factory for THIS TLS config test + bdbID, factory, cleanup := SetupTestDatabaseAndFactory(t, ctx, "standalone") + defer cleanup() + t.Logf("[TLS-CONFIGS-%s] Created test database with bdb_id: %d", tlsTest.name, bdbID) + + // Get endpoint config from factory (now connected to new database) + endpointConfig := factory.GetConfig() + + // Create fault injector + faultInjector, err := CreateTestFaultInjector() + if err != nil { + t.Fatalf("[ERROR] Failed to create fault injector: %v", err) + } + + defer func() { + if dump { + p("Pool stats:") + factory.PrintPoolStats(t) + } + }() + errorsDetected = false var ef = func(format string, args ...interface{}) { printLog("TLS-CONFIGS", true, format, args...)