@@ -66,9 +66,9 @@ func TestScheduleMachineOf(t *testing.T) {
66
66
67
67
// All 6 services should be visible immediately and become ACTIVE
68
68
// shortly thereafter
69
- stdout , _ , err := cluster .Fleetctl (m0 , "list-unit-files" , "--no-legend" )
69
+ stdout , stderr , err := cluster .Fleetctl (m0 , "list-unit-files" , "--no-legend" )
70
70
if err != nil {
71
- t .Fatalf ("Failed to run list-unit-files: %v" , err )
71
+ t .Fatalf ("Failed to run list-unit-files:\n stdout: %s \n stderr: %s \n err: %v" , stdout , stderr , err )
72
72
}
73
73
units := strings .Split (strings .TrimSpace (stdout ), "\n " )
74
74
if len (units ) != 6 {
@@ -113,8 +113,8 @@ func TestScheduleMachineOf(t *testing.T) {
113
113
114
114
// Ensure a pair of units migrate together when their host goes down
115
115
mach := states ["ping.1.service" ].Machine
116
- if _ , _ , err = cluster .Fleetctl (m0 , "--strict-host-key-checking=false" , "ssh" , mach , "sudo" , "systemctl" , "stop" , "fleet" ); err != nil {
117
- t .Fatal ( err )
116
+ if stdout , stderr , err = cluster .Fleetctl (m0 , "--strict-host-key-checking=false" , "ssh" , mach , "sudo" , "systemctl" , "stop" , "fleet" ); err != nil {
117
+ t .Fatalf ( "Failed to stop fleet service: \n stdout: %s \n stderr: %s \n err: %v" , stdout , stderr , err )
118
118
}
119
119
120
120
var mN platform.Member
@@ -184,9 +184,9 @@ func TestScheduleConflicts(t *testing.T) {
184
184
185
185
// All 5 services should be visible immediately and 3 should become
186
186
// ACTIVE shortly thereafter
187
- stdout , _ , err := cluster .Fleetctl (m0 , "list-unit-files" , "--no-legend" )
187
+ stdout , stderr , err := cluster .Fleetctl (m0 , "list-unit-files" , "--no-legend" )
188
188
if err != nil {
189
- t .Fatalf ("Failed to run list-unit-files: %v" , err )
189
+ t .Fatalf ("Failed to run list-unit-files:\n stdout: %s \n stderr: %s \n err: %v" , stdout , stderr , err )
190
190
}
191
191
units := strings .Split (strings .TrimSpace (stdout ), "\n " )
192
192
if len (units ) != 5 {
@@ -256,9 +256,9 @@ func TestScheduleOneWayConflict(t *testing.T) {
256
256
257
257
// Both units should show up, but only conflicts-with-hello.service
258
258
// should report ACTIVE
259
- stdout , _ , err := cluster .Fleetctl (m0 , "list-unit-files" , "--no-legend" )
259
+ stdout , stderr , err := cluster .Fleetctl (m0 , "list-unit-files" , "--no-legend" )
260
260
if err != nil {
261
- t .Fatalf ("Failed to run list-unit-files: %v" , err )
261
+ t .Fatalf ("Failed to run list-unit-files:\n stdout: %s \n stderr: %s \n err: %v" , stdout , stderr , err )
262
262
}
263
263
units := strings .Split (strings .TrimSpace (stdout ), "\n " )
264
264
if len (units ) != 2 {
@@ -281,8 +281,8 @@ func TestScheduleOneWayConflict(t *testing.T) {
281
281
282
282
// Destroying the conflicting unit should allow the other to start
283
283
name = "conflicts-with-hello.service"
284
- if _ , _ , err := cluster .Fleetctl (m0 , "destroy" , name ); err != nil {
285
- t .Fatalf ("Failed destroying %s" , name )
284
+ if stdout , stderr , err := cluster .Fleetctl (m0 , "destroy" , name ); err != nil {
285
+ t .Fatalf ("Failed destroying %s: \n stdout: %s \n stderr: %s \n err: %v " , name , stdout , stderr , err )
286
286
}
287
287
288
288
// NOTE: we need to sleep here shortly to avoid occasional errors of
@@ -295,13 +295,14 @@ func TestScheduleOneWayConflict(t *testing.T) {
295
295
time .Sleep (1 * time .Second )
296
296
297
297
// Wait for the destroyed unit to actually disappear
298
+ var stdoutBuf , stderrBuf string
298
299
timeout , err := util .WaitForState (
299
300
func () bool {
300
- stdout , _ , err : = cluster .Fleetctl (m0 , "list-units" , "--no-legend" , "--full" , "--fields" , "unit,active,machine" )
301
+ stdoutBuf , stderrBuf , err = cluster .Fleetctl (m0 , "list-units" , "--no-legend" , "--full" , "--fields" , "unit,active,machine" )
301
302
if err != nil {
302
303
return false
303
304
}
304
- lines := strings .Split (strings .TrimSpace (stdout ), "\n " )
305
+ lines := strings .Split (strings .TrimSpace (stdoutBuf ), "\n " )
305
306
states := util .ParseUnitStates (lines )
306
307
for _ , state := range states {
307
308
if state .Name == name {
@@ -312,7 +313,8 @@ func TestScheduleOneWayConflict(t *testing.T) {
312
313
},
313
314
)
314
315
if err != nil {
315
- t .Fatalf ("Destroyed unit %s not gone within %v" , name , timeout )
316
+ t .Fatalf ("Destroyed unit %s not gone within %v\n stdout: %s\n stderr: %s\n err: %v" ,
317
+ name , timeout , stdoutBuf , stderrBuf , err )
316
318
}
317
319
318
320
active , err = cluster .WaitForNActiveUnits (m0 , 1 )
@@ -374,9 +376,9 @@ func TestScheduleReplace(t *testing.T) {
374
376
}
375
377
376
378
// Check that both units should show up
377
- stdout , _ , err := cluster .Fleetctl (m0 , "list-unit-files" , "--no-legend" )
379
+ stdout , stderr , err := cluster .Fleetctl (m0 , "list-unit-files" , "--no-legend" )
378
380
if err != nil {
379
- t .Fatalf ("Failed to run list-unit-files: %v" , err )
381
+ t .Fatalf ("Failed to run list-unit-files:\n stdout: %s \n stderr: %s \n err: %v" , stdout , stderr , err )
380
382
}
381
383
units := strings .Split (strings .TrimSpace (stdout ), "\n " )
382
384
if len (units ) != 2 {
@@ -450,9 +452,9 @@ func TestScheduleCircularReplace(t *testing.T) {
450
452
uName0tmp , stdout , stderr , err )
451
453
}
452
454
453
- stdout , _ , err = cluster .Fleetctl (m0 , "list-unit-files" , "--no-legend" )
455
+ stdout , stderr , err = cluster .Fleetctl (m0 , "list-unit-files" , "--no-legend" )
454
456
if err != nil {
455
- t .Fatalf ("Failed to run list-unit-files: %v" , err )
457
+ t .Fatalf ("Failed to run list-unit-files:\n stdout: %s \n stderr: %s \n err: %v" , stdout , stderr , err )
456
458
}
457
459
units := strings .Split (strings .TrimSpace (stdout ), "\n " )
458
460
if len (units ) != nActiveUnits {
@@ -472,9 +474,9 @@ func TestScheduleCircularReplace(t *testing.T) {
472
474
if stdout , stderr , err := cluster .Fleetctl (m0 , "start" , "--no-block" , uNames [1 ]); err != nil {
473
475
t .Fatalf ("Failed starting unit %s: \n stdout: %s\n stderr: %s\n err: %v" , uNames [1 ], stdout , stderr , err )
474
476
}
475
- stdout , _ , err = cluster .Fleetctl (m0 , "list-unit-files" , "--no-legend" )
477
+ stdout , stderr , err = cluster .Fleetctl (m0 , "list-unit-files" , "--no-legend" )
476
478
if err != nil {
477
- t .Fatalf ("Failed to run list-unit-files: %v" , err )
479
+ t .Fatalf ("Failed to run list-unit-files:\n stdout: %s \n stderr: %s \n err: %v" , stdout , stderr , err )
478
480
}
479
481
units = strings .Split (strings .TrimSpace (stdout ), "\n " )
480
482
if len (units ) != nUnits {
0 commit comments