@@ -147,8 +147,7 @@ func TestPushNotifications(t *testing.T) {
147147 failoverResp , err := faultInjector .TriggerAction (ctx , ActionRequest {
148148 Type : "failover" ,
149149 Parameters : map [string ]interface {}{
150- "cluster_index" : "0" ,
151- "bdb_id" : endpointConfig .BdbID ,
150+ "bdb_id" : endpointConfig .BdbID ,
152151 },
153152 })
154153 if err != nil {
@@ -199,7 +198,7 @@ func TestPushNotifications(t *testing.T) {
199198 migrateResp , err := faultInjector .TriggerAction (ctx , ActionRequest {
200199 Type : "migrate" ,
201200 Parameters : map [string ]interface {}{
202- "cluster_index " : "0" ,
201+ "bdb_id " : endpointConfig . BdbID ,
203202 },
204203 })
205204 if err != nil {
@@ -251,8 +250,7 @@ func TestPushNotifications(t *testing.T) {
251250 bindResp , err := faultInjector .TriggerAction (ctx , ActionRequest {
252251 Type : "bind" ,
253252 Parameters : map [string ]interface {}{
254- "cluster_index" : "0" ,
255- "bdb_id" : endpointConfig .BdbID ,
253+ "bdb_id" : endpointConfig .BdbID ,
256254 },
257255 })
258256 if err != nil {
@@ -297,7 +295,7 @@ func TestPushNotifications(t *testing.T) {
297295 }
298296 }()
299297
300- p ("Waiting for MOVING notification on second client" )
298+ p ("Waiting for MOVING notification on first client" )
301299 match , found = logCollector .MatchOrWaitForLogMatchFunc (func (s string ) bool {
302300 return strings .Contains (s , logs2 .ProcessingNotificationMessage ) && notificationType (s , "MOVING" )
303301 }, 3 * time .Minute )
@@ -314,6 +312,7 @@ func TestPushNotifications(t *testing.T) {
314312 // wait for moving on second client
315313 // 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
316314 // also validate big enough relaxed timeout
315+ p ("Waiting for MOVING notification on second client" )
317316 match , found = logCollector .MatchOrWaitForLogMatchFunc (func (s string ) bool {
318317 return strings .Contains (s , logs2 .ProcessingNotificationMessage ) && notificationType (s , "MOVING" ) && connID (s , 18 )
319318 }, 3 * time .Minute )
@@ -372,27 +371,21 @@ func TestPushNotifications(t *testing.T) {
372371 p ("Third client created" )
373372 go commandsRunner3 .FireCommandsUntilStop (ctx )
374373 // wait for moving on third client
375- match , found = logCollector .MatchOrWaitForLogMatchFunc (func (s string ) bool {
376- return strings .Contains (s , logs2 .ProcessingNotificationMessage ) && notificationType (s , "MOVING" ) && connID (s , 19 )
377- }, 3 * time .Minute )
374+ movingNotification , found := tracker .FindOrWaitForNotification ("MOVING" , 3 * time .Minute )
378375 if ! found {
379376 p ("[NOTICE] MOVING notification was not received within 3 minutes ON A THIRD CLIENT" )
380377 } else {
381- data := logs2 .ExtractDataFromLogMessage (match )
382378 p ("MOVING notification received on third client. %v" , data )
383- mNotif := data ["notification" ].(string )
384- // format MOVING <seqID> <timeS> endpoint
385- mNotifParts := strings .Split (mNotif , " " )
386- if len (mNotifParts ) != 4 {
387- ef ("Invalid MOVING notification format: %s" , mNotif )
379+ if len (movingNotification ) != 4 {
380+ p ("[NOTICE] Invalid MOVING notification format: %s" , mNotif )
388381 }
389- mNotifTimeS , err := strconv .Atoi (mNotifParts [2 ])
382+ mNotifTimeS , err := strconv .Atoi (movingNotification [2 ].( string ) )
390383 if err != nil {
391- ef ( " Invalid timeS in MOVING notification: %s" , mNotif )
384+ p ( "[NOTICE] Invalid timeS in MOVING notification: %s" , movingNotification )
392385 }
393386 // expect timeS to be less than 15
394387 if mNotifTimeS < 15 {
395- ef ( " Expected timeS < 15, got %d" , mNotifTimeS )
388+ p ( "[NOTICE] Expected timeS < 15, got %d" , mNotifTimeS )
396389 }
397390 }
398391 commandsRunner3 .Stop ()
0 commit comments