From 3633b44cea75c06d09ad89c213e56571eed1c141 Mon Sep 17 00:00:00 2001 From: Bryce Palmer Date: Fri, 24 Jul 2026 13:32:20 -0400 Subject: [PATCH] wip: add support for parsing JUnit testcase lifecycle Signed-off-by: Bryce Palmer --- pkg/apis/junit/types.go | 3 ++ .../prowloader/extract_test_cases_test.go | 37 +++++++++++++++++++ pkg/dataloader/prowloader/prow.go | 1 + pkg/dataloader/prowloader/types/types.go | 1 + 4 files changed, 42 insertions(+) diff --git a/pkg/apis/junit/types.go b/pkg/apis/junit/types.go index e5423e26fc..31fd4d100a 100644 --- a/pkg/apis/junit/types.go +++ b/pkg/apis/junit/types.go @@ -68,6 +68,9 @@ type TestCase struct { // Duration is the time taken in seconds to run the test Duration float64 `xml:"time,attr"` + // Lifecycle is the lifecycle of this test case + Lifecycle string `xml:"lifecycle,attr"` + // SkipMessage holds the reason why the test was skipped SkipMessage *SkipMessage `xml:"skipped"` diff --git a/pkg/dataloader/prowloader/extract_test_cases_test.go b/pkg/dataloader/prowloader/extract_test_cases_test.go index f342972a1d..da065fa236 100644 --- a/pkg/dataloader/prowloader/extract_test_cases_test.go +++ b/pkg/dataloader/prowloader/extract_test_cases_test.go @@ -144,6 +144,43 @@ func TestExtractTestCases(t *testing.T) { }, }, }, + { + name: "passing test with lifecycle", + suite: &junit.TestSuite{ + Name: "openshift-tests", + TestCases: []*junit.TestCase{ + {Name: "test-a", Duration: 1.5, Lifecycle: "informing"}, + }, + }, + expected: map[testCaseKey]*types.TestCaseEntry{ + {SuiteName: "openshift-tests", TestName: "test-a"}: { + TestName: "test-a", + SuiteName: "openshift-tests", + Status: int(sippyprocessingv1.TestStatusSuccess), + Duration: 1.5, + Lifecycle: "informing", + }, + }, + }, + { + name: "failing test with output and lifecycle", + suite: &junit.TestSuite{ + Name: "openshift-tests", + TestCases: []*junit.TestCase{ + {Name: "test-a", Duration: 2.0, FailureOutput: &junit.FailureOutput{Output: failMsg}, Lifecycle: "blocking"}, + }, + }, + expected: map[testCaseKey]*types.TestCaseEntry{ + {SuiteName: "openshift-tests", TestName: "test-a"}: { + TestName: "test-a", + SuiteName: "openshift-tests", + Status: int(sippyprocessingv1.TestStatusFailure), + Duration: 2.0, + Output: &failMsg, + Lifecycle: "blocking", + }, + }, + }, } for _, tt := range tests { diff --git a/pkg/dataloader/prowloader/prow.go b/pkg/dataloader/prowloader/prow.go index 463e76578a..e59cc62501 100644 --- a/pkg/dataloader/prowloader/prow.go +++ b/pkg/dataloader/prowloader/prow.go @@ -1717,6 +1717,7 @@ func extractTestCases(suite *junit.TestSuite, testCases map[testCaseKey]*types.T Status: int(status), Duration: tc.Duration, Output: output, + Lifecycle: tc.Lifecycle, } } else if (existing.Status == int(sippyprocessingv1.TestStatusFailure) && status == sippyprocessingv1.TestStatusSuccess) || (existing.Status == int(sippyprocessingv1.TestStatusSuccess) && status == sippyprocessingv1.TestStatusFailure) { diff --git a/pkg/dataloader/prowloader/types/types.go b/pkg/dataloader/prowloader/types/types.go index 261c089e86..bf47e34605 100644 --- a/pkg/dataloader/prowloader/types/types.go +++ b/pkg/dataloader/prowloader/types/types.go @@ -6,4 +6,5 @@ type TestCaseEntry struct { Status int Duration float64 Output *string + Lifecycle string }