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)
|
ctx, cancel := context.WithTimeout(context.Background(), 25*time.Minute)
|
||||||
defer cancel()
|
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 dump = true
|
||||||
var errorsDetected = false
|
var errorsDetected = false
|
||||||
|
|
||||||
@@ -62,26 +54,29 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
|
|||||||
logCollector.Clear()
|
logCollector.Clear()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Create fault injector
|
// Test each endpoint type with its own fresh database
|
||||||
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
|
|
||||||
for _, endpointTest := range endpointTypes {
|
for _, endpointTest := range endpointTypes {
|
||||||
t.Run(endpointTest.name, func(t *testing.T) {
|
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
|
// Clear logs between endpoint type tests
|
||||||
logCollector.Clear()
|
logCollector.Clear()
|
||||||
// reset errors detected flag
|
// reset errors detected flag
|
||||||
|
@@ -22,14 +22,6 @@ func TestTimeoutConfigurationsPushNotifications(t *testing.T) {
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
|
||||||
defer cancel()
|
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 dump = true
|
||||||
|
|
||||||
var errorsDetected = false
|
var errorsDetected = false
|
||||||
@@ -82,26 +74,30 @@ func TestTimeoutConfigurationsPushNotifications(t *testing.T) {
|
|||||||
logCollector.Clear()
|
logCollector.Clear()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Get endpoint config from factory (now connected to new database)
|
// Test each timeout configuration with its own fresh 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
|
|
||||||
for _, timeoutTest := range timeoutConfigs {
|
for _, timeoutTest := range timeoutConfigs {
|
||||||
t.Run(timeoutTest.name, func(t *testing.T) {
|
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
|
errorsDetected = false
|
||||||
var ef = func(format string, args ...interface{}) {
|
var ef = func(format string, args ...interface{}) {
|
||||||
printLog("TIMEOUT-CONFIGS", true, format, args...)
|
printLog("TIMEOUT-CONFIGS", true, format, args...)
|
||||||
|
@@ -23,14 +23,6 @@ func ТestTLSConfigurationsPushNotifications(t *testing.T) {
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), 25*time.Minute)
|
ctx, cancel := context.WithTimeout(context.Background(), 25*time.Minute)
|
||||||
defer cancel()
|
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 dump = true
|
||||||
var errorsDetected = false
|
var errorsDetected = false
|
||||||
var p = func(format string, args ...interface{}) {
|
var p = func(format string, args ...interface{}) {
|
||||||
@@ -78,26 +70,30 @@ func ТestTLSConfigurationsPushNotifications(t *testing.T) {
|
|||||||
logCollector.Clear()
|
logCollector.Clear()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Get endpoint config from factory (now connected to new database)
|
// Test each TLS configuration with its own fresh 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
|
|
||||||
for _, tlsTest := range tlsConfigs {
|
for _, tlsTest := range tlsConfigs {
|
||||||
t.Run(tlsTest.name, func(t *testing.T) {
|
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
|
errorsDetected = false
|
||||||
var ef = func(format string, args ...interface{}) {
|
var ef = func(format string, args ...interface{}) {
|
||||||
printLog("TLS-CONFIGS", true, format, args...)
|
printLog("TLS-CONFIGS", true, format, args...)
|
||||||
|
Reference in New Issue
Block a user