diff --git a/cmd/testrunner.go b/cmd/testrunner.go index 5d8ad8dd6..578f70aa1 100644 --- a/cmd/testrunner.go +++ b/cmd/testrunner.go @@ -365,11 +365,15 @@ func testTypeCommandActionFactory(runner testrunner.TestRunner) cobraext.Command RunTestsOnly: runTestsOnly, RunIndependentElasticAgent: runIndependentElasticAgent, }) + + // Results must be appended even if there is an error, since there could be + // tests (e.g. system tests) that return both error and results. + results = append(results, r...) + if err != nil { return fmt.Errorf("error running package %s tests: %w", testType, err) } - results = append(results, r...) } format := testrunner.TestReportFormat(reportFormat)