Skip to content

Commit 20cd0e1

Browse files
authored
fix(worker): warn for invalid junit file (#6011)
Signed-off-by: francois samin <francois.samin@corp.ovh.com>
1 parent 06307e1 commit 20cd0e1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

engine/worker/internal/action/builtin_junit.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,21 @@ func RunParseJunitTestResultAction(ctx context.Context, wk workerruntime.Runtime
7575
ftests.TestSuites = append(ftests.TestSuites, s)
7676
}
7777
tests.TestSuites = append(tests.TestSuites, ftests.TestSuites...)
78+
if len(ftests.TestSuites) == 0 {
79+
log.Error(ctx, "unable to find testsuites in %q", f)
80+
wk.SendLog(ctx, workerruntime.LevelInfo, fmt.Sprintf("WARNING: unable to parse %q as valid xUnit report file", filepath.Base(f)))
81+
continue
82+
}
83+
log.Info(ctx, "found %d testsuites in %q", len(ftests.TestSuites), f)
7884
} else {
7985
tests.TestSuites = append(tests.TestSuites, vf.TestSuites...)
86+
87+
if len(ftests.TestSuites) == 0 {
88+
log.Error(ctx, "unable to find testsuites in %q", f)
89+
wk.SendLog(ctx, workerruntime.LevelInfo, fmt.Sprintf("WARNING: unable to parse %q as valid xUnit report file", filepath.Base(f)))
90+
continue
91+
}
92+
log.Info(ctx, "found %d testsuites in %q", len(vf.TestSuites), f)
8093
}
8194
}
8295

0 commit comments

Comments
 (0)