mirror of
https://github.com/redis/go-redis.git
synced 2025-10-18 22:08:50 +03:00
db per scenario
This commit is contained in:
@@ -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
|
||||
|
@@ -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...)
|
||||
|
@@ -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...)
|
||||
|
Reference in New Issue
Block a user