Skip to content

Commit aa1b3b9

Browse files
committed
revert test order
1 parent 1fdbeb3 commit aa1b3b9

File tree

1 file changed

+55
-55
lines changed

1 file changed

+55
-55
lines changed

maintnotifications/e2e/scenario_endpoint_types_test.go

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
6161
}()
6262

6363
// Create client factory from configuration
64-
factory, err := CreateTestClientFactory("standalone")
64+
factory, err := CreateTestClientFactory("standlone")
6565
if err != nil {
6666
t.Skipf("Enterprise cluster not available, skipping endpoint types test: %v", err)
6767
}
@@ -159,6 +159,56 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
159159
commandsRunner.Stop()
160160
}()
161161

162+
// Test failover with this endpoint type
163+
p("Testing failover with %s endpoint type...", endpointTest.name)
164+
failoverResp, err := faultInjector.TriggerAction(ctx, ActionRequest{
165+
Type: "failover",
166+
Parameters: map[string]interface{}{
167+
"cluster_index": "0",
168+
"bdb_id": endpointConfig.BdbID,
169+
},
170+
})
171+
if err != nil {
172+
t.Fatalf("Failed to trigger failover action for %s: %v", endpointTest.name, err)
173+
}
174+
175+
// Start command traffic
176+
go func() {
177+
commandsRunner.FireCommandsUntilStop(ctx)
178+
}()
179+
180+
// Wait for FAILING_OVER notification
181+
match, found := logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool {
182+
return strings.Contains(s, logs2.ProcessingNotificationMessage) && notificationType(s, "FAILING_OVER")
183+
}, 2*time.Minute)
184+
if !found {
185+
t.Fatalf("FAILING_OVER notification was not received for %s endpoint type", endpointTest.name)
186+
}
187+
failingOverData := logs2.ExtractDataFromLogMessage(match)
188+
p("FAILING_OVER notification received for %s. %v", endpointTest.name, failingOverData)
189+
190+
// Wait for FAILED_OVER notification
191+
seqIDToObserve := int64(failingOverData["seqID"].(float64))
192+
connIDToObserve := uint64(failingOverData["connID"].(float64))
193+
match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool {
194+
return notificationType(s, "FAILED_OVER") && connID(s, connIDToObserve) && seqID(s, seqIDToObserve+1)
195+
}, 2*time.Minute)
196+
if !found {
197+
t.Fatalf("FAILED_OVER notification was not received for %s endpoint type", endpointTest.name)
198+
}
199+
failedOverData := logs2.ExtractDataFromLogMessage(match)
200+
p("FAILED_OVER notification received for %s. %v", endpointTest.name, failedOverData)
201+
202+
// Wait for failover to complete
203+
status, err := faultInjector.WaitForAction(ctx, failoverResp.ActionID,
204+
WithMaxWaitTime(120*time.Second),
205+
WithPollInterval(1*time.Second),
206+
)
207+
if err != nil {
208+
t.Fatalf("[FI] Failover action failed for %s: %v", endpointTest.name, err)
209+
}
210+
p("[FI] Failover action completed for %s: %s", endpointTest.name, status.Status)
211+
162212
// Test migration with this endpoint type
163213
p("Testing migration with %s endpoint type...", endpointTest.name)
164214
migrateResp, err := faultInjector.TriggerAction(ctx, ActionRequest{
@@ -172,7 +222,7 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
172222
}
173223

174224
// Wait for MIGRATING notification
175-
match, found := logCollector.WaitForLogMatchFunc(func(s string) bool {
225+
match, found = logCollector.WaitForLogMatchFunc(func(s string) bool {
176226
return strings.Contains(s, logs2.ProcessingNotificationMessage) && strings.Contains(s, "MIGRATING")
177227
}, 30*time.Second)
178228
if !found {
@@ -182,7 +232,7 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
182232
p("MIGRATING notification received for %s: %v", endpointTest.name, migrateData)
183233

184234
// Wait for migration to complete
185-
status, err := faultInjector.WaitForAction(ctx, migrateResp.ActionID,
235+
status, err = faultInjector.WaitForAction(ctx, migrateResp.ActionID,
186236
WithMaxWaitTime(120*time.Second),
187237
WithPollInterval(1*time.Second),
188238
)
@@ -192,8 +242,8 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
192242
p("[FI] Migrate action completed for %s: %s", endpointTest.name, status.Status)
193243

194244
// Wait for MIGRATED notification
195-
seqIDToObserve := int64(migrateData["seqID"].(float64))
196-
connIDToObserve := uint64(migrateData["connID"].(float64))
245+
seqIDToObserve = int64(migrateData["seqID"].(float64))
246+
connIDToObserve = uint64(migrateData["connID"].(float64))
197247
match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool {
198248
return notificationType(s, "MIGRATED") && connID(s, connIDToObserve) && seqID(s, seqIDToObserve+1)
199249
}, 2*time.Minute)
@@ -276,56 +326,6 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
276326
}
277327
p("Bind action completed for %s: %s", endpointTest.name, bindStatus.Status)
278328

279-
// Test failover with this endpoint type
280-
p("Testing failover with %s endpoint type...", endpointTest.name)
281-
failoverResp, err := faultInjector.TriggerAction(ctx, ActionRequest{
282-
Type: "failover",
283-
Parameters: map[string]interface{}{
284-
"cluster_index": "0",
285-
"bdb_id": endpointConfig.BdbID,
286-
},
287-
})
288-
if err != nil {
289-
t.Fatalf("Failed to trigger failover action for %s: %v", endpointTest.name, err)
290-
}
291-
292-
// Start command traffic
293-
go func() {
294-
commandsRunner.FireCommandsUntilStop(ctx)
295-
}()
296-
297-
// Wait for FAILING_OVER notification
298-
match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool {
299-
return strings.Contains(s, logs2.ProcessingNotificationMessage) && notificationType(s, "FAILING_OVER")
300-
}, 2*time.Minute)
301-
if !found {
302-
t.Fatalf("FAILING_OVER notification was not received for %s endpoint type", endpointTest.name)
303-
}
304-
failingOverData := logs2.ExtractDataFromLogMessage(match)
305-
p("FAILING_OVER notification received for %s. %v", endpointTest.name, failingOverData)
306-
307-
// Wait for FAILED_OVER notification
308-
seqIDToObserve = int64(failingOverData["seqID"].(float64))
309-
connIDToObserve = uint64(failingOverData["connID"].(float64))
310-
match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool {
311-
return notificationType(s, "FAILED_OVER") && connID(s, connIDToObserve) && seqID(s, seqIDToObserve+1)
312-
}, 2*time.Minute)
313-
if !found {
314-
t.Fatalf("FAILED_OVER notification was not received for %s endpoint type", endpointTest.name)
315-
}
316-
failedOverData := logs2.ExtractDataFromLogMessage(match)
317-
p("FAILED_OVER notification received for %s. %v", endpointTest.name, failedOverData)
318-
319-
// Wait for failover to complete
320-
status, err = faultInjector.WaitForAction(ctx, failoverResp.ActionID,
321-
WithMaxWaitTime(120*time.Second),
322-
WithPollInterval(1*time.Second),
323-
)
324-
if err != nil {
325-
t.Fatalf("[FI] Failover action failed for %s: %v", endpointTest.name, err)
326-
}
327-
p("[FI] Failover action completed for %s: %s", endpointTest.name, status.Status)
328-
329329
// Continue traffic for analysis
330330
time.Sleep(30 * time.Second)
331331
commandsRunner.Stop()

0 commit comments

Comments
 (0)