diff --git a/main.go b/main.go index 8c828f1..a658d66 100644 --- a/main.go +++ b/main.go @@ -405,12 +405,7 @@ func junit2csv(testSuites []junit.Suite, p params, output io.Writer) error { func (j junit2jira) findFailedTests(testSuites []junit.Suite) ([]testCase, error) { failedTests := make([]testCase, 0) for _, ts := range testSuites { - for _, tc := range ts.Tests { - if tc.Error == nil { - continue - } - failedTests = j.addFailedTest(failedTests, tc) - } + failedTests = j.addFailedTests(ts, failedTests) } log.Infof("Found %d failed tests", len(failedTests)) @@ -421,6 +416,19 @@ func (j junit2jira) findFailedTests(testSuites []junit.Suite) ([]testCase, error return failedTests, nil } +func (j junit2jira) addFailedTests(ts junit.Suite, failedTests []testCase) []testCase { + for _, suite := range ts.Suites { + failedTests = j.addFailedTests(suite, failedTests) + } + for _, tc := range ts.Tests { + if tc.Error == nil { + continue + } + failedTests = j.addTest(failedTests, tc) + } + return failedTests +} + func (j junit2jira) mergeFailedTests(failedTests []testCase) ([]testCase, error) { log.Warning("Too many failed tests, reporting them as a one failure.") msg := "" @@ -443,7 +451,7 @@ func (j junit2jira) mergeFailedTests(failedTests []testCase) ([]testCase, error) return []testCase{tc}, nil } -func (j junit2jira) addFailedTest(failedTests []testCase, tc junit.Test) []testCase { +func (j junit2jira) addTest(failedTests []testCase, tc junit.Test) []testCase { if !isSubTest(tc) { return append(failedTests, NewTestCase(tc, j.params)) } diff --git a/main_test.go b/main_test.go index 3a0e0a4..c5ff6c2 100644 --- a/main_test.go +++ b/main_test.go @@ -74,6 +74,7 @@ github.com/stackrox/rox/sensor/kubernetes/localscanner / TestLocalScannerTLSIssu []testCase{ { Message: `DefaultPoliciesTest / Verify policy Apache Struts CVE-2017-5638 is triggered FAILED +central-basic / step 90-activate-scanner-v4 FAILED github.com/stackrox/rox/pkg/booleanpolicy/evaluator / TestDifferentBaseTypes FAILED github.com/stackrox/rox/sensor/kubernetes/localscanner / TestLocalScannerTLSIssuerIntegrationTests FAILED github.com/stackrox/rox/central/resourcecollection/datastore/store/postgres / TestCollectionsStore FAILED @@ -161,6 +162,13 @@ command-line-arguments / TestTimeout FAILED Error: "panic: test timed out after 1ns\n\ngoroutine 7 [running]:\ntesting.(*M).startAlarm.func1()\n\t/snap/go/10030/src/testing/testing.go:2036 +0x8e\ncreated by time.goFunc\n\t/snap/go/10030/src/time/sleep.go:176 +0x32\n\ngoroutine 1 [chan receive]:\ntesting.(*T).Run(0xc0000076c0, {0x5254af?, 0x4b7c05?}, 0x52f280)\n\t/snap/go/10030/src/testing/testing.go:1494 +0x37a\ntesting.runTests.func1(0xc00007e390?)\n\t/snap/go/10030/src/testing/testing.go:1846 +0x6e\ntesting.tRunner(0xc0000076c0, 0xc000104cd8)\n\t/snap/go/10030/src/testing/testing.go:1446 +0x10b\ntesting.runTests(0xc000000140?, {0x5fde10, 0x1, 0x1}, {0x7f398ed8a108?, 0x40?, 0x606c20?})\n\t/snap/go/10030/src/testing/testing.go:1844 +0x456\ntesting.(*M).Run(0xc000000140)\n\t/snap/go/10030/src/testing/testing.go:1726 +0x5d9\nmain.main()\n\t_testmain.go:47 +0x1aa\n\ngoroutine 6 [runnable]:\ntesting.pcToName(0x4b7dd4)\n\t/snap/go/10030/src/testing/testing.go:1226 +0x3d\ntesting.callerName(0x0?)\n\t/snap/go/10030/src/testing/testing.go:1222 +0x45\ntesting.tRunner(0xc000007860, 0x52f280)\n\t/snap/go/10030/src/testing/testing.go:1307 +0x34\ncreated by testing.(*T).Run\n\t/snap/go/10030/src/testing/testing.go:1493 +0x35f", BuildId: "1", }, + { + Name: "step 90-activate-scanner-v4", + Suite: "central-basic", + Message: "failed in step 90-activate-scanner-v4", + Error: "resource PersistentVolumeClaim:kuttl-test-apparent-gelding/scanner-v4-db: .spec.accessModes: value mismatch, expected: ReadWriteOncex != actual: ReadWriteOnce", + BuildId: "1", + }, }, tests, ) diff --git a/testdata/jira/kuttl-report.xml b/testdata/jira/kuttl-report.xml new file mode 100644 index 0000000..d39896e --- /dev/null +++ b/testdata/jira/kuttl-report.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + resource PersistentVolumeClaim:kuttl-test-apparent-gelding/scanner-v4-db: .spec.accessModes: value mismatch, expected: ReadWriteOncex != actual: ReadWriteOnce + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file