Skip to content

Commit 7329e31

Browse files
committed
second and third client fix
1 parent e27d232 commit 7329e31

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

maintnotifications/e2e/scenario_endpoint_types_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
207207
if err != nil {
208208
ef("[FI] Failover action failed for %s: %v", endpointTest.name, err)
209209
}
210-
p("[FI] Failover action completed for %s: %+v", endpointTest.name, status)
210+
p("[FI] Failover action completed for %s: %+v", endpointTest.name, status.Status)
211211

212212
// Test migration with this endpoint type
213213
p("Testing migration with %s endpoint type...", endpointTest.name)
@@ -229,7 +229,7 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
229229
if err != nil {
230230
ef("[FI] Migrate action failed for %s: %v", endpointTest.name, err)
231231
}
232-
p("[FI] Migrate action completed for %s: %+v", endpointTest.name, status)
232+
p("[FI] Migrate action completed for %s: %+v", endpointTest.name, status.Status)
233233

234234
// Wait for MIGRATING notification
235235
match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool {
@@ -323,7 +323,7 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
323323
if err != nil {
324324
ef("Bind action failed for %s: %v", endpointTest.name, err)
325325
}
326-
p("Bind action completed for %s: %+v", endpointTest.name, bindStatus)
326+
p("Bind action completed for %s: %+v", endpointTest.name, bindStatus.Status)
327327

328328
// Continue traffic for analysis
329329
time.Sleep(30 * time.Second)

maintnotifications/e2e/scenario_push_notifications_test.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func TestPushNotifications(t *testing.T) {
166166
if err != nil {
167167
ef("[FI] Failover action failed: %v", err)
168168
}
169-
p("[FI] Failover action completed: %+v", status)
169+
p("[FI] Failover action completed: %+v", status.Status)
170170

171171
p("FAILING_OVER / FAILED_OVER notifications test completed successfully")
172172

@@ -203,7 +203,7 @@ func TestPushNotifications(t *testing.T) {
203203
if err != nil {
204204
ef("[FI] Migrate action failed: %v", err)
205205
}
206-
p("[FI] Migrate action completed: %+v", status)
206+
p("[FI] Migrate action completed: %+v", status.Status)
207207

208208
go func() {
209209
p("Waiting for MIGRATED notification on conn %d with seqID %d...", connIDToObserve, seqIDToObserve+1)
@@ -266,6 +266,9 @@ func TestPushNotifications(t *testing.T) {
266266
errChan := make(chan error, 1)
267267

268268
go func() {
269+
var match string
270+
var matchNotif []interface{}
271+
var found bool
269272
defer func() {
270273
if r := recover(); r != nil {
271274
errChan <- fmt.Errorf("goroutine panic: %v", r)
@@ -290,15 +293,14 @@ func TestPushNotifications(t *testing.T) {
290293
// 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
291294
// also validate big enough relaxed timeout
292295
p("Waiting for MOVING notification on second client")
293-
match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool {
294-
return strings.Contains(s, logs2.ProcessingNotificationMessage) && notificationType(s, "MOVING") && connID(s, 18)
295-
}, 3*time.Minute)
296+
matchNotif, found = tracker2.FindOrWaitForNotification("MOVING", 3*time.Minute)
296297
if !found {
297298
errChan <- fmt.Errorf("MOVING notification was not received within 3 minutes ON A SECOND CLIENT")
298299
return
299300
} else {
300-
p("MOVING notification received on second client %v", logs2.ExtractDataFromLogMessage(match))
301+
p("MOVING notification received on second client %v", matchNotif)
301302
}
303+
302304
// wait for relaxation of 30m
303305
match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool {
304306
return strings.Contains(s, logs2.ApplyingRelaxedTimeoutDueToPostHandoffMessage) && strings.Contains(s, "30m")
@@ -319,6 +321,7 @@ func TestPushNotifications(t *testing.T) {
319321
seqIDToObserve = int64(movingData["seqID"].(float64))
320322
connIDToObserve = uint64(movingData["connID"].(float64))
321323

324+
time.Sleep(3 * time.Second)
322325
// start a third client but don't execute any commands on it
323326
p("Starting a third client to observe notification during moving...")
324327
client3, err := factory.Create("push-notification-client-2", &CreateClientOptions{
@@ -348,7 +351,7 @@ func TestPushNotifications(t *testing.T) {
348351
p("Third client created")
349352
go commandsRunner3.FireCommandsUntilStop(ctx)
350353
// wait for moving on third client
351-
movingNotification, found := tracker.FindOrWaitForNotification("MOVING", 3*time.Minute)
354+
movingNotification, found := tracker3.FindOrWaitForNotification("MOVING", 3*time.Minute)
352355
if !found {
353356
p("[NOTICE] MOVING notification was not received within 3 minutes ON A THIRD CLIENT")
354357
} else {
@@ -379,7 +382,7 @@ func TestPushNotifications(t *testing.T) {
379382
ef("Bind action failed: %v", err)
380383
}
381384

382-
p("Bind action completed: %+v", bindStatus)
385+
p("Bind action completed: %+v", bindStatus.Status)
383386

384387
p("MOVING notification test completed successfully")
385388

maintnotifications/e2e/scenario_stress_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ func TestStressPushNotifications(t *testing.T) {
199199
}
200200

201201
actionMutex.Lock()
202-
actionResults = append(actionResults, fmt.Sprintf("%s: %+v", actionName, status))
202+
actionResults = append(actionResults, fmt.Sprintf("%s: %+v", actionName, status.Status))
203203
actionMutex.Unlock()
204204

205-
p("[FI] %s action completed: %+v", actionName, status)
205+
p("[FI] %s action completed: %+v", actionName, status.Status)
206206
}(action.name, action.action, action.delay)
207207
}
208208

maintnotifications/e2e/scenario_timeout_configs_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func TestTimeoutConfigurationsPushNotifications(t *testing.T) {
209209
if err != nil {
210210
ef("[FI] Failover action failed for %s: %v", timeoutTest.name, err)
211211
}
212-
p("[FI] Failover action completed for %s: %+v", timeoutTest.name, status)
212+
p("[FI] Failover action completed for %s: %+v", timeoutTest.name, status.Status)
213213

214214
// Continue traffic to observe timeout behavior
215215
p("Continuing traffic for %v to observe timeout behavior...", timeoutTest.relaxedTimeout*2)
@@ -236,7 +236,7 @@ func TestTimeoutConfigurationsPushNotifications(t *testing.T) {
236236
ef("[FI] Migrate action failed for %s: %v", timeoutTest.name, err)
237237
}
238238

239-
p("[FI] Migrate action completed for %s: %+v", timeoutTest.name, status)
239+
p("[FI] Migrate action completed for %s: %+v", timeoutTest.name, status.Status)
240240

241241
// Wait for MIGRATING notification
242242
match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool {
@@ -265,7 +265,8 @@ func TestTimeoutConfigurationsPushNotifications(t *testing.T) {
265265
if err != nil {
266266
ef("[FI] Bind action failed for %s: %v", timeoutTest.name, err)
267267
}
268-
p("[FI] Bind action completed for %s: %+v", timeoutTest.name, status)
268+
p("[FI] Bind action completed for %s: %+v", timeoutTest.name, status.Status)
269+
269270
// waiting for moving notification
270271
match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool {
271272
return strings.Contains(s, logs2.ProcessingNotificationMessage) && notificationType(s, "MOVING")

0 commit comments

Comments
 (0)