From 7329e31e2a6f7d6043558ace35e38a852a39a28f Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov Date: Mon, 6 Oct 2025 20:40:14 +0300 Subject: [PATCH] second and third client fix --- .../e2e/scenario_endpoint_types_test.go | 6 +++--- .../e2e/scenario_push_notifications_test.go | 19 +++++++++++-------- .../e2e/scenario_stress_test.go | 4 ++-- .../e2e/scenario_timeout_configs_test.go | 7 ++++--- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/maintnotifications/e2e/scenario_endpoint_types_test.go b/maintnotifications/e2e/scenario_endpoint_types_test.go index a52609de..90e5c137 100644 --- a/maintnotifications/e2e/scenario_endpoint_types_test.go +++ b/maintnotifications/e2e/scenario_endpoint_types_test.go @@ -207,7 +207,7 @@ func TestEndpointTypesPushNotifications(t *testing.T) { if err != nil { ef("[FI] Failover action failed for %s: %v", endpointTest.name, err) } - p("[FI] Failover action completed for %s: %+v", endpointTest.name, status) + p("[FI] Failover action completed for %s: %+v", endpointTest.name, status.Status) // Test migration with this endpoint type p("Testing migration with %s endpoint type...", endpointTest.name) @@ -229,7 +229,7 @@ func TestEndpointTypesPushNotifications(t *testing.T) { if err != nil { ef("[FI] Migrate action failed for %s: %v", endpointTest.name, err) } - p("[FI] Migrate action completed for %s: %+v", endpointTest.name, status) + p("[FI] Migrate action completed for %s: %+v", endpointTest.name, status.Status) // Wait for MIGRATING notification match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool { @@ -323,7 +323,7 @@ func TestEndpointTypesPushNotifications(t *testing.T) { if err != nil { ef("Bind action failed for %s: %v", endpointTest.name, err) } - p("Bind action completed for %s: %+v", endpointTest.name, bindStatus) + p("Bind action completed for %s: %+v", endpointTest.name, bindStatus.Status) // Continue traffic for analysis time.Sleep(30 * time.Second) diff --git a/maintnotifications/e2e/scenario_push_notifications_test.go b/maintnotifications/e2e/scenario_push_notifications_test.go index a90a46cd..8f327185 100644 --- a/maintnotifications/e2e/scenario_push_notifications_test.go +++ b/maintnotifications/e2e/scenario_push_notifications_test.go @@ -166,7 +166,7 @@ func TestPushNotifications(t *testing.T) { if err != nil { ef("[FI] Failover action failed: %v", err) } - p("[FI] Failover action completed: %+v", status) + p("[FI] Failover action completed: %+v", status.Status) p("FAILING_OVER / FAILED_OVER notifications test completed successfully") @@ -203,7 +203,7 @@ func TestPushNotifications(t *testing.T) { if err != nil { ef("[FI] Migrate action failed: %v", err) } - p("[FI] Migrate action completed: %+v", status) + p("[FI] Migrate action completed: %+v", status.Status) go func() { p("Waiting for MIGRATED notification on conn %d with seqID %d...", connIDToObserve, seqIDToObserve+1) @@ -266,6 +266,9 @@ func TestPushNotifications(t *testing.T) { errChan := make(chan error, 1) go func() { + var match string + var matchNotif []interface{} + var found bool defer func() { if r := recover(); r != nil { errChan <- fmt.Errorf("goroutine panic: %v", r) @@ -290,15 +293,14 @@ func TestPushNotifications(t *testing.T) { // we know the maxconn is 15, assuming 16/17 was used to init the second client, so connID 18 should be from the second client // also validate big enough relaxed timeout p("Waiting for MOVING notification on second client") - match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool { - return strings.Contains(s, logs2.ProcessingNotificationMessage) && notificationType(s, "MOVING") && connID(s, 18) - }, 3*time.Minute) + matchNotif, found = tracker2.FindOrWaitForNotification("MOVING", 3*time.Minute) if !found { errChan <- fmt.Errorf("MOVING notification was not received within 3 minutes ON A SECOND CLIENT") return } else { - p("MOVING notification received on second client %v", logs2.ExtractDataFromLogMessage(match)) + p("MOVING notification received on second client %v", matchNotif) } + // wait for relaxation of 30m match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool { return strings.Contains(s, logs2.ApplyingRelaxedTimeoutDueToPostHandoffMessage) && strings.Contains(s, "30m") @@ -319,6 +321,7 @@ func TestPushNotifications(t *testing.T) { seqIDToObserve = int64(movingData["seqID"].(float64)) connIDToObserve = uint64(movingData["connID"].(float64)) + time.Sleep(3 * time.Second) // start a third client but don't execute any commands on it p("Starting a third client to observe notification during moving...") client3, err := factory.Create("push-notification-client-2", &CreateClientOptions{ @@ -348,7 +351,7 @@ func TestPushNotifications(t *testing.T) { p("Third client created") go commandsRunner3.FireCommandsUntilStop(ctx) // wait for moving on third client - movingNotification, found := tracker.FindOrWaitForNotification("MOVING", 3*time.Minute) + movingNotification, found := tracker3.FindOrWaitForNotification("MOVING", 3*time.Minute) if !found { p("[NOTICE] MOVING notification was not received within 3 minutes ON A THIRD CLIENT") } else { @@ -379,7 +382,7 @@ func TestPushNotifications(t *testing.T) { ef("Bind action failed: %v", err) } - p("Bind action completed: %+v", bindStatus) + p("Bind action completed: %+v", bindStatus.Status) p("MOVING notification test completed successfully") diff --git a/maintnotifications/e2e/scenario_stress_test.go b/maintnotifications/e2e/scenario_stress_test.go index edb8ed8b..ed14f0c6 100644 --- a/maintnotifications/e2e/scenario_stress_test.go +++ b/maintnotifications/e2e/scenario_stress_test.go @@ -199,10 +199,10 @@ func TestStressPushNotifications(t *testing.T) { } actionMutex.Lock() - actionResults = append(actionResults, fmt.Sprintf("%s: %+v", actionName, status)) + actionResults = append(actionResults, fmt.Sprintf("%s: %+v", actionName, status.Status)) actionMutex.Unlock() - p("[FI] %s action completed: %+v", actionName, status) + p("[FI] %s action completed: %+v", actionName, status.Status) }(action.name, action.action, action.delay) } diff --git a/maintnotifications/e2e/scenario_timeout_configs_test.go b/maintnotifications/e2e/scenario_timeout_configs_test.go index bd808c59..9b6e346a 100644 --- a/maintnotifications/e2e/scenario_timeout_configs_test.go +++ b/maintnotifications/e2e/scenario_timeout_configs_test.go @@ -209,7 +209,7 @@ func TestTimeoutConfigurationsPushNotifications(t *testing.T) { if err != nil { ef("[FI] Failover action failed for %s: %v", timeoutTest.name, err) } - p("[FI] Failover action completed for %s: %+v", timeoutTest.name, status) + p("[FI] Failover action completed for %s: %+v", timeoutTest.name, status.Status) // Continue traffic to observe timeout behavior p("Continuing traffic for %v to observe timeout behavior...", timeoutTest.relaxedTimeout*2) @@ -236,7 +236,7 @@ func TestTimeoutConfigurationsPushNotifications(t *testing.T) { ef("[FI] Migrate action failed for %s: %v", timeoutTest.name, err) } - p("[FI] Migrate action completed for %s: %+v", timeoutTest.name, status) + p("[FI] Migrate action completed for %s: %+v", timeoutTest.name, status.Status) // Wait for MIGRATING notification match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool { @@ -265,7 +265,8 @@ func TestTimeoutConfigurationsPushNotifications(t *testing.T) { if err != nil { ef("[FI] Bind action failed for %s: %v", timeoutTest.name, err) } - p("[FI] Bind action completed for %s: %+v", timeoutTest.name, status) + p("[FI] Bind action completed for %s: %+v", timeoutTest.name, status.Status) + // waiting for moving notification match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool { return strings.Contains(s, logs2.ProcessingNotificationMessage) && notificationType(s, "MOVING")