Skip to content

Commit dbe717b

Browse files
committed
db per scenario
1 parent 8b1b8b6 commit dbe717b

File tree

3 files changed

+62
-75
lines changed

3 files changed

+62
-75
lines changed

maintnotifications/e2e/scenario_endpoint_types_test.go

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
2424
ctx, cancel := context.WithTimeout(context.Background(), 25*time.Minute)
2525
defer cancel()
2626

27-
// Setup: Create fresh database and client factory for this test
28-
bdbID, factory, cleanup := SetupTestDatabaseAndFactory(t, ctx, "standalone")
29-
defer cleanup()
30-
t.Logf("[ENDPOINT-TYPES] Created test database with bdb_id: %d", bdbID)
31-
32-
// Wait for database to be fully ready
33-
time.Sleep(10 * time.Second)
34-
3527
var dump = true
3628
var errorsDetected = false
3729

@@ -62,26 +54,29 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
6254
logCollector.Clear()
6355
}()
6456

65-
// Create fault injector
66-
faultInjector, err := CreateTestFaultInjector()
67-
if err != nil {
68-
t.Fatalf("[ERROR] Failed to create fault injector: %v", err)
69-
}
57+
// Test each endpoint type with its own fresh database
58+
for _, endpointTest := range endpointTypes {
59+
t.Run(endpointTest.name, func(t *testing.T) {
60+
// Setup: Create fresh database and client factory for THIS endpoint type test
61+
bdbID, factory, cleanup := SetupTestDatabaseAndFactory(t, ctx, "standalone")
62+
defer cleanup()
63+
t.Logf("[ENDPOINT-TYPES-%s] Created test database with bdb_id: %d", endpointTest.name, bdbID)
7064

71-
// Get endpoint config from factory (now connected to new database)
72-
endpointConfig := factory.GetConfig()
65+
// Create fault injector
66+
faultInjector, err := CreateTestFaultInjector()
67+
if err != nil {
68+
t.Fatalf("[ERROR] Failed to create fault injector: %v", err)
69+
}
7370

74-
defer func() {
75-
if dump {
76-
fmt.Println("Pool stats:")
77-
factory.PrintPoolStats(t)
78-
}
79-
// Note: factory.DestroyAll() is called by cleanup() function
80-
}()
71+
// Get endpoint config from factory (now connected to new database)
72+
endpointConfig := factory.GetConfig()
8173

82-
// Test each endpoint type
83-
for _, endpointTest := range endpointTypes {
84-
t.Run(endpointTest.name, func(t *testing.T) {
74+
defer func() {
75+
if dump {
76+
fmt.Println("Pool stats:")
77+
factory.PrintPoolStats(t)
78+
}
79+
}()
8580
// Clear logs between endpoint type tests
8681
logCollector.Clear()
8782
// reset errors detected flag

maintnotifications/e2e/scenario_timeout_configs_test.go

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ func TestTimeoutConfigurationsPushNotifications(t *testing.T) {
2222
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
2323
defer cancel()
2424

25-
// Setup: Create fresh database and client factory for this test
26-
bdbID, factory, cleanup := SetupTestDatabaseAndFactory(t, ctx, "standalone")
27-
defer cleanup()
28-
t.Logf("[TIMEOUT-CONFIGS] Created test database with bdb_id: %d", bdbID)
29-
30-
// Wait for database to be fully ready
31-
time.Sleep(10 * time.Second)
32-
3325
var dump = true
3426

3527
var errorsDetected = false
@@ -82,26 +74,30 @@ func TestTimeoutConfigurationsPushNotifications(t *testing.T) {
8274
logCollector.Clear()
8375
}()
8476

85-
// Get endpoint config from factory (now connected to new database)
86-
endpointConfig := factory.GetConfig()
77+
// Test each timeout configuration with its own fresh database
78+
for _, timeoutTest := range timeoutConfigs {
79+
t.Run(timeoutTest.name, func(t *testing.T) {
80+
// Setup: Create fresh database and client factory for THIS timeout config test
81+
bdbID, factory, cleanup := SetupTestDatabaseAndFactory(t, ctx, "standalone")
82+
defer cleanup()
83+
t.Logf("[TIMEOUT-CONFIGS-%s] Created test database with bdb_id: %d", timeoutTest.name, bdbID)
8784

88-
// Create fault injector
89-
faultInjector, err := CreateTestFaultInjector()
90-
if err != nil {
91-
t.Fatalf("[ERROR] Failed to create fault injector: %v", err)
92-
}
85+
// Get endpoint config from factory (now connected to new database)
86+
endpointConfig := factory.GetConfig()
9387

94-
defer func() {
95-
if dump {
96-
p("Pool stats:")
97-
factory.PrintPoolStats(t)
98-
}
99-
// Note: factory.DestroyAll() is called by cleanup() function
100-
}()
88+
// Create fault injector
89+
faultInjector, err := CreateTestFaultInjector()
90+
if err != nil {
91+
t.Fatalf("[ERROR] Failed to create fault injector: %v", err)
92+
}
93+
94+
defer func() {
95+
if dump {
96+
p("Pool stats:")
97+
factory.PrintPoolStats(t)
98+
}
99+
}()
101100

102-
// Test each timeout configuration
103-
for _, timeoutTest := range timeoutConfigs {
104-
t.Run(timeoutTest.name, func(t *testing.T) {
105101
errorsDetected = false
106102
var ef = func(format string, args ...interface{}) {
107103
printLog("TIMEOUT-CONFIGS", true, format, args...)

maintnotifications/e2e/scenario_tls_configs_test.go

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ func ТestTLSConfigurationsPushNotifications(t *testing.T) {
2323
ctx, cancel := context.WithTimeout(context.Background(), 25*time.Minute)
2424
defer cancel()
2525

26-
// Setup: Create fresh database and client factory for this test
27-
bdbID, factory, cleanup := SetupTestDatabaseAndFactory(t, ctx, "standalone")
28-
defer cleanup()
29-
t.Logf("[TLS-CONFIGS] Created test database with bdb_id: %d", bdbID)
30-
31-
// Wait for database to be fully ready
32-
time.Sleep(10 * time.Second)
33-
3426
var dump = true
3527
var errorsDetected = false
3628
var p = func(format string, args ...interface{}) {
@@ -78,26 +70,30 @@ func ТestTLSConfigurationsPushNotifications(t *testing.T) {
7870
logCollector.Clear()
7971
}()
8072

81-
// Get endpoint config from factory (now connected to new database)
82-
endpointConfig := factory.GetConfig()
73+
// Test each TLS configuration with its own fresh database
74+
for _, tlsTest := range tlsConfigs {
75+
t.Run(tlsTest.name, func(t *testing.T) {
76+
// Setup: Create fresh database and client factory for THIS TLS config test
77+
bdbID, factory, cleanup := SetupTestDatabaseAndFactory(t, ctx, "standalone")
78+
defer cleanup()
79+
t.Logf("[TLS-CONFIGS-%s] Created test database with bdb_id: %d", tlsTest.name, bdbID)
8380

84-
// Create fault injector
85-
faultInjector, err := CreateTestFaultInjector()
86-
if err != nil {
87-
t.Fatalf("[ERROR] Failed to create fault injector: %v", err)
88-
}
81+
// Get endpoint config from factory (now connected to new database)
82+
endpointConfig := factory.GetConfig()
8983

90-
defer func() {
91-
if dump {
92-
p("Pool stats:")
93-
factory.PrintPoolStats(t)
94-
}
95-
// Note: factory.DestroyAll() is called by cleanup() function
96-
}()
84+
// Create fault injector
85+
faultInjector, err := CreateTestFaultInjector()
86+
if err != nil {
87+
t.Fatalf("[ERROR] Failed to create fault injector: %v", err)
88+
}
89+
90+
defer func() {
91+
if dump {
92+
p("Pool stats:")
93+
factory.PrintPoolStats(t)
94+
}
95+
}()
9796

98-
// Test each TLS configuration
99-
for _, tlsTest := range tlsConfigs {
100-
t.Run(tlsTest.name, func(t *testing.T) {
10197
errorsDetected = false
10298
var ef = func(format string, args ...interface{}) {
10399
printLog("TLS-CONFIGS", true, format, args...)

0 commit comments

Comments
 (0)