Skip to content

JUnit output can contain helm warnings, resulting in invalid XML #2

@Makeshift

Description

@Makeshift

There's currently no 'output to file' option for this tool, meaning you need to write stdout into files if you want, for example, the junit tests to be discoverable by other tooling.

Unfortunately this can sometimes mean that warnings output from Helm can end up in the file if you're simply redirecting stdout:

coalesce.go:298: warning: cannot overwrite table with non table for tolerateSpot (map[])
<testsuites name="kubeconform" time="0.127582172" tests="8" failures="0" disabled="0" errors="0">
  <testsuite name="stdin" id="1" tests="8" failures="0" errors="0" disabled="0" skipped="0">
    <testcase name="release-name" classname="ServiceAccount@v1" time="0"></testcase>
    <testcase name="release-name" classname="Service@v1" time="0"></testcase>
    <testcase name="release-name" classname="PodDisruptionBudget@policy/v1" time="0"></testcase>
    <testcase name="release-name" classname="Service@v1" time="0"></testcase>
    <testcase name="release-name" classname="Ingress@networking.k8s.io/v1" time="0"></testcase>
    <testcase name="release-name" classname="HorizontalPodAutoscaler@autoscaling/v2" time="0"></testcase>
    <testcase name="release-name" classname="ServiceMonitor@monitoring.coreos.com/v1" time="0"></testcase>
    <testcase name="release-name" classname="Deployment@apps/v1" time="0"></testcase>
  </testsuite>
</testsuites>

A couple of potential fixes for this:

  • Output warnings to stderr, so it can be appropriately redirected
  • Add an option to save the junit results to a file directly

My current workaround is just a grep filter:

helm kubeconform  --output="junit" . | { grep -v ".go" || true; } | tee "junit.xml"

Still a great little tool though, thanks for this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions