Skip to content

CNF-23887: Populate JUnit XML timestamp, hostname, and duration#64

Open
sebrandon1 wants to merge 1 commit into
openshift:mainfrom
sebrandon1:junit-metadata
Open

CNF-23887: Populate JUnit XML timestamp, hostname, and duration#64
sebrandon1 wants to merge 1 commit into
openshift:mainfrom
sebrandon1:junit-metadata

Conversation

@sebrandon1
Copy link
Copy Markdown
Member

Summary

  • Populate timestamp, hostname, and time attributes on the JUnit XML <testsuite> element — these are standard JUnit attributes expected by CI systems like Prow and Jenkins
  • Add Duration field to ScanResults, computed centrally in assembleResults
  • Add duration_seconds (float64) to JSON output for human-readable scan timing (time.Duration is suppressed from JSON since it serializes as nanoseconds)

Jira: CNF-23887

Before

<testsuite name="TLSSecurityScan" tests="52" failures="0" time="0">

After

<testsuite name="TLSSecurityScan" tests="52" failures="0" time="1754.187"
           timestamp="2026-05-14T13:59:05-05:00" hostname="bpalm-mac">

JSON output (new field)

{
  "timestamp": "2026-05-14T13:59:05-05:00",
  "duration_seconds": 1754.19
}

Test plan

  • go build ./... passes
  • go test ./... passes
  • Live scan against cnfdt16 cluster with --junit-file and --json-file confirms all three attributes populated
  • Existing JUnit test updated to assert new fields

The JUnit XML testsuite element was missing standard attributes that CI
systems expect. Add timestamp, hostname, and time attributes, and expose
scan duration in both JUnit XML and JSON output.

- Add Duration and DurationSeconds fields to ScanResults
- Compute duration centrally in assembleResults
- Populate testsuite timestamp, hostname, time in JUnit XML
- Add hostname() helper with os.Hostname fallback
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented May 14, 2026

@sebrandon1: This pull request references CNF-23887 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Populate timestamp, hostname, and time attributes on the JUnit XML <testsuite> element — these are standard JUnit attributes expected by CI systems like Prow and Jenkins
  • Add Duration field to ScanResults, computed centrally in assembleResults
  • Add duration_seconds (float64) to JSON output for human-readable scan timing (time.Duration is suppressed from JSON since it serializes as nanoseconds)

Jira: CNF-23887

Before

<testsuite name="TLSSecurityScan" tests="52" failures="0" time="0">

After

<testsuite name="TLSSecurityScan" tests="52" failures="0" time="1754.187"
          timestamp="2026-05-14T13:59:05-05:00" hostname="bpalm-mac">

JSON output (new field)

{
 "timestamp": "2026-05-14T13:59:05-05:00",
 "duration_seconds": 1754.19
}

Test plan

  • go build ./... passes
  • go test ./... passes
  • Live scan against cnfdt16 cluster with --junit-file and --json-file confirms all three attributes populated
  • Existing JUnit test updated to assert new fields

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 14, 2026
@openshift-ci openshift-ci Bot requested review from rhmdnd and richardsonnick May 14, 2026 19:39
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 14, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sebrandon1
Once this PR has been reviewed and has the lgtm label, please assign richardsonnick for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 14, 2026

@sebrandon1: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants