Skip to content

Commit 1adb576

Browse files
committed
print output if failed
1 parent 7329e31 commit 1adb576

File tree

6 files changed

+25
-14
lines changed

6 files changed

+25
-14
lines changed

maintnotifications/e2e/scenario_endpoint_types_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,13 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
6666
t.Fatalf("[ERROR] Failed to create fault injector: %v", err)
6767
}
6868

69-
7069
// Create client factory from configuration
7170
factory, err := CreateTestClientFactory("standalone")
7271
if err != nil {
7372
t.Skipf("Enterprise cluster not available, skipping endpoint types test: %v", err)
7473
}
7574
endpointConfig := factory.GetConfig()
7675

77-
7876
defer func() {
7977
if dump {
8078
p("Pool stats:")
@@ -207,7 +205,7 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
207205
if err != nil {
208206
ef("[FI] Failover action failed for %s: %v", endpointTest.name, err)
209207
}
210-
p("[FI] Failover action completed for %s: %+v", endpointTest.name, status.Status)
208+
p("[FI] Failover action completed for %s: %s %s", endpointTest.name, status.Status, actionOutputIfFailed(status))
211209

212210
// Test migration with this endpoint type
213211
p("Testing migration with %s endpoint type...", endpointTest.name)
@@ -229,7 +227,7 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
229227
if err != nil {
230228
ef("[FI] Migrate action failed for %s: %v", endpointTest.name, err)
231229
}
232-
p("[FI] Migrate action completed for %s: %+v", endpointTest.name, status.Status)
230+
p("[FI] Migrate action completed for %s: %s %s", endpointTest.name, status.Status, actionOutputIfFailed(status))
233231

234232
// Wait for MIGRATING notification
235233
match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool {
@@ -323,7 +321,7 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
323321
if err != nil {
324322
ef("Bind action failed for %s: %v", endpointTest.name, err)
325323
}
326-
p("Bind action completed for %s: %+v", endpointTest.name, bindStatus.Status)
324+
p("Bind action completed for %s: %s %s", endpointTest.name, bindStatus.Status, actionOutputIfFailed(bindStatus))
327325

328326
// Continue traffic for analysis
329327
time.Sleep(30 * time.Second)

maintnotifications/e2e/scenario_push_notifications_test.go

Lines changed: 3 additions & 3 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.Status)
169+
p("[FI] Failover action completed: %v %s", status.Status, actionOutputIfFailed(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.Status)
206+
p("[FI] Migrate action completed: %s %s", status.Status, actionOutputIfFailed(status))
207207

208208
go func() {
209209
p("Waiting for MIGRATED notification on conn %d with seqID %d...", connIDToObserve, seqIDToObserve+1)
@@ -382,7 +382,7 @@ func TestPushNotifications(t *testing.T) {
382382
ef("Bind action failed: %v", err)
383383
}
384384

385-
p("Bind action completed: %+v", bindStatus.Status)
385+
p("Bind action completed: %s %s", bindStatus.Status, actionOutputIfFailed(bindStatus))
386386

387387
p("MOVING notification test completed successfully")
388388

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.Status))
202+
actionResults = append(actionResults, fmt.Sprintf("%s: %s %s", actionName, status.Status, actionOutputIfFailed(status)))
203203
actionMutex.Unlock()
204204

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

maintnotifications/e2e/scenario_timeout_configs_test.go

Lines changed: 3 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.Status)
212+
p("[FI] Failover action completed for %s: %s %s", timeoutTest.name, status.Status, actionOutputIfFailed(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.Status)
239+
p("[FI] Migrate action completed for %s: %s %s", timeoutTest.name, status.Status, actionOutputIfFailed(status))
240240

241241
// Wait for MIGRATING notification
242242
match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool {
@@ -265,7 +265,7 @@ 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.Status)
268+
p("[FI] Bind action completed for %s: %s %s", timeoutTest.name, status.Status, actionOutputIfFailed(status))
269269

270270
// waiting for moving notification
271271
match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool {

maintnotifications/e2e/scenario_tls_configs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func ТestTLSConfigurationsPushNotifications(t *testing.T) {
199199
if err != nil {
200200
ef("[FI] Migrate action failed for %s: %v", tlsTest.name, err)
201201
}
202-
p("[FI] Migrate action completed for %s: %+v", tlsTest.name, status)
202+
p("[FI] Migrate action completed for %s: %s %s", tlsTest.name, status.Status, actionOutputIfFailed(status))
203203

204204
// Continue traffic for a bit to observe TLS behavior
205205
time.Sleep(5 * time.Second)

maintnotifications/e2e/utils_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,16 @@ func printLog(group string, isError bool, format string, args ...interface{}) {
6161
args = append([]interface{}{filename, line, ts, group}, args...)
6262
fmt.Printf(finalFormat, args...)
6363
}
64+
65+
func actionOutputIfFailed(status *ActionStatusResponse) string {
66+
if status.Status != StatusFailed {
67+
return ""
68+
}
69+
if status.Error != nil {
70+
return fmt.Sprintf("%v", status.Error)
71+
}
72+
if status.Output == nil {
73+
return ""
74+
}
75+
return fmt.Sprintf("%+v", status.Output)
76+
}

0 commit comments

Comments
 (0)