Skip to content

Fix scorecard XUnit output#5652

Merged
jmrodri merged 1 commit intooperator-framework:masterfrom
ryantking:fix/gh5457_fix-xunit-output
Apr 13, 2022
Merged

Fix scorecard XUnit output#5652
jmrodri merged 1 commit intooperator-framework:masterfrom
ryantking:fix/gh5457_fix-xunit-output

Conversation

@ryantking
Copy link
Copy Markdown
Contributor

Currently, scorecard's XUnit output does not conform to any XUnit
schema. This makes the scorecard XUnit output conform with the XUnit
schema defined by the Jenkins XUnit plugin.

This is sample output from running scorecard against the sample Go v3
Memcached operator:

<testsuites name="scorecard">
  <testsuite name="olm-bundle-validation-test" tests="1" skipped="0" failures="0" errors="0">
    <properties>
      <property name="spec.image" value="quay.io/operator-framework/scorecard-test:v1.19.0"></property>
      <property name="spec.entrypoint" value="scorecard-test olm-bundle-validation"></property>
      <property name="labels.test" value="olm-bundle-validation-test"></property>
    </properties>
    <testcase name="olm-bundle-validation" time="0001-01-01T00:00:00Z">
      <system-out>time=&#34;2022-04-12T19:21:52Z&#34; level=debug msg=&#34;Found manifests directory&#34; name=bundle-test&#xA;time=&#34;2022-04-12T19:21:52Z&#34; level=debug msg=&#34;Found metadata directory&#34; name=bundle-test&#xA;time=&#34;2022-04-12T19:21:52Z&#34; level=debug msg=&#34;Getting mediaType info from manifests directory&#34; name=bundle-test&#xA;time=&#34;2022-04-12T19:21:52Z&#34; level=debug msg=&#34;Found annotations file&#34; name=bundle-test&#xA;time=&#34;2022-04-12T19:21:52Z&#34; level=debug msg=&#34;Could not find optional dependencies file&#34; name=bundle-test&#xA;</system-out>
    </testcase>
  </testsuite>
  <!-- Some suites omitted for readability -->
</testsuites>

The full output can be recreated by installing the operator-sdk tool
built from this commit and running scorecard against the sample Go v3
memcached operator:

cd /path/to/operator-sdk
make install
operator-sdk scorecard testdata/go/v3/memcached-operator

The XUnit XSD schema can be found here:
https://github.com/jenkinsci/xunit-plugin/blob/master/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd

The tool used to validate the output against the schema can be found
here: https://www.freeformatter.com/xml-validator-xsd.html

Signed-off-by: Ryan King ryking@redhat.com

Currently, scorecard's XUnit output does not conform to any XUnit
schema. This makes the scorecard XUnit output conform with the XUnit
schema defined by the Jenkins XUnit plugin.

This is sample output from running scorecard against the sample Go v3
Memcached operator:

```xml
<testsuites name="scorecard">
  <testsuite name="olm-bundle-validation-test" tests="1" skipped="0" failures="0" errors="0">
    <properties>
      <property name="spec.image" value="quay.io/operator-framework/scorecard-test:v1.19.0"></property>
      <property name="spec.entrypoint" value="scorecard-test olm-bundle-validation"></property>
      <property name="labels.test" value="olm-bundle-validation-test"></property>
    </properties>
    <testcase name="olm-bundle-validation" time="0001-01-01T00:00:00Z">
      <system-out>time=&operator-framework#34;2022-04-12T19:21:52Z&operator-framework#34; level=debug msg=&operator-framework#34;Found manifests directory&operator-framework#34; name=bundle-test&#xA;time=&operator-framework#34;2022-04-12T19:21:52Z&operator-framework#34; level=debug msg=&operator-framework#34;Found metadata directory&operator-framework#34; name=bundle-test&#xA;time=&operator-framework#34;2022-04-12T19:21:52Z&operator-framework#34; level=debug msg=&operator-framework#34;Getting mediaType info from manifests directory&operator-framework#34; name=bundle-test&#xA;time=&operator-framework#34;2022-04-12T19:21:52Z&operator-framework#34; level=debug msg=&operator-framework#34;Found annotations file&operator-framework#34; name=bundle-test&#xA;time=&operator-framework#34;2022-04-12T19:21:52Z&operator-framework#34; level=debug msg=&operator-framework#34;Could not find optional dependencies file&operator-framework#34; name=bundle-test&#xA;</system-out>
    </testcase>
  </testsuite>
  <!-- Some suites omitted for readability -->
</testsuites>
```

The full output can be recreated by installing the `operator-sdk` tool
built from this commit and running scorecard against the sample Go v3
memcached operator:

```
cd /path/to/operator-sdk
make install
operator-sdk scorecard testdata/go/v3/memcached-operator
```

The XUnit XSD schema can be found here:
https://github.com/jenkinsci/xunit-plugin/blob/master/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd

The tool used to validate the output against the schema can be found
here: https://www.freeformatter.com/xml-validator-xsd.html

Signed-off-by: Ryan King <ryking@redhat.com>
@jberkhahn
Copy link
Copy Markdown
Contributor

/lgtm

what scorecard config did you use? i just pulled the default one from the docs and can confirm it works with that

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 12, 2022
Copy link
Copy Markdown
Member

@jmrodri jmrodri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@jmrodri jmrodri merged commit 5d541d0 into operator-framework:master Apr 13, 2022
@ryantking ryantking deleted the fix/gh5457_fix-xunit-output branch April 13, 2022 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants