@@ -45,13 +45,6 @@ func New(ctx context.Context, config *Config, version string, shutdownCallback f
45
45
return nil , errors .New ("config is required" )
46
46
}
47
47
48
- config .Log .Debug ("Creating NAT with config" ,
49
- "testDir" , config .TestDir ,
50
- "validatorConfig" , config .ValidatorConfig ,
51
- "runInterval" , config .RunInterval ,
52
- "runOnce" , config .RunOnce ,
53
- "allowSkips" , config .AllowSkips )
54
-
55
48
reg , err := registry .NewRegistry (registry.Config {
56
49
Log : config .Log ,
57
50
ValidatorConfigFile : config .ValidatorConfig ,
@@ -72,7 +65,16 @@ func New(ctx context.Context, config *Config, version string, shutdownCallback f
72
65
if err != nil {
73
66
return nil , fmt .Errorf ("failed to create test runner: %w" , err )
74
67
}
75
- config .Log .Info ("nat.New: created registry and test runner" )
68
+
69
+ config .Log .Debug ("Created NAT with config" ,
70
+ "testDir" , config .TestDir ,
71
+ "validatorConfig" , config .ValidatorConfig ,
72
+ "targetGate" , config .TargetGate ,
73
+ "runInterval" , config .RunInterval ,
74
+ "runOnce" , config .RunOnce ,
75
+ "allowSkips" , config .AllowSkips ,
76
+ "goBinary" , config .GoBinary ,
77
+ )
76
78
77
79
return & nat {
78
80
ctx : ctx ,
@@ -124,9 +126,8 @@ func (n *nat) Start(ctx context.Context) error {
124
126
125
127
// Check if any tests failed and return appropriate exit code
126
128
if n .result != nil && n .result .Status == types .TestStatusFail {
127
- n .config .Log .Warn ("Run-once test run completed with failures, returning exit code 1" )
128
- // Return exit code 1 for test failures (assertions failed)
129
- return NewTestFailureError (n .result .String ())
129
+ n .config .Log .Warn ("Run-once test run completed with failures" )
130
+ return NewTestFailureError ("Run-once test run completed with failures" )
130
131
}
131
132
132
133
// Only need to call this when we're in run-once mode and all tests passed
@@ -260,6 +261,7 @@ func (n *nat) printResultsTable(runID string) {
260
261
gate .Stats .Skipped ,
261
262
getResultString (gate .Status ),
262
263
"" ,
264
+ "" , // No stdout for gates
263
265
})
264
266
265
267
// Print suites in this gate
@@ -274,6 +276,7 @@ func (n *nat) printResultsTable(runID string) {
274
276
suite .Stats .Skipped ,
275
277
getResultString (suite .Status ),
276
278
"" ,
279
+ "" , // No stdout for suites
277
280
})
278
281
279
282
// Print tests in this suite
@@ -297,7 +300,7 @@ func (n *nat) printResultsTable(runID string) {
297
300
boolToInt (test .Status == types .TestStatusFail ),
298
301
boolToInt (test .Status == types .TestStatusSkip ),
299
302
getResultString (test .Status ),
300
- test .Error ,
303
+ getErrorMessage ( test .Status , test . Error ) ,
301
304
})
302
305
303
306
// Display individual sub-tests if present (for package tests)
@@ -318,7 +321,7 @@ func (n *nat) printResultsTable(runID string) {
318
321
boolToInt (subTest .Status == types .TestStatusFail ),
319
322
boolToInt (subTest .Status == types .TestStatusSkip ),
320
323
getResultString (subTest .Status ),
321
- subTest .Error ,
324
+ getErrorMessage ( subTest .Status , subTest . Error ) ,
322
325
})
323
326
j ++
324
327
}
@@ -349,7 +352,7 @@ func (n *nat) printResultsTable(runID string) {
349
352
boolToInt (test .Status == types .TestStatusFail ),
350
353
boolToInt (test .Status == types .TestStatusSkip ),
351
354
getResultString (test .Status ),
352
- test .Error ,
355
+ getErrorMessage ( test .Status , test . Error ) ,
353
356
})
354
357
355
358
// Display individual sub-tests if present (for package tests)
@@ -370,12 +373,11 @@ func (n *nat) printResultsTable(runID string) {
370
373
boolToInt (subTest .Status == types .TestStatusFail ),
371
374
boolToInt (subTest .Status == types .TestStatusSkip ),
372
375
getResultString (subTest .Status ),
373
- subTest .Error ,
376
+ getErrorMessage ( subTest .Status , subTest . Error ) ,
374
377
})
375
378
j ++
376
379
}
377
380
}
378
-
379
381
i ++
380
382
}
381
383
@@ -443,6 +445,14 @@ func formatDuration(d time.Duration) string {
443
445
return fmt .Sprintf ("%.1fs" , d .Seconds ())
444
446
}
445
447
448
+ // getErrorMessage returns the error message if test failed, empty string otherwise
449
+ func getErrorMessage (status types.TestStatus , err error ) string {
450
+ if status == types .TestStatusFail && err != nil {
451
+ return err .Error ()
452
+ }
453
+ return ""
454
+ }
455
+
446
456
// WaitForShutdown blocks until all goroutines have terminated.
447
457
// This is useful in tests to ensure complete cleanup before moving to the next test.
448
458
func (n * nat ) WaitForShutdown (ctx context.Context ) error {
0 commit comments