bug: connectivity test --junit-file emits malformed XML (duplicate failureMessage attribute)

Open Beginner friendly
#3,333 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@cvas22 is already working on this.

Since Nov 4, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go, kubernetes, xml
Domain
cli, testing

Research direction

Start with cilium-cli/connectivity/internal/junit/junit.go, where the issue says failure attributes are assembled in more than one place. Reproduce with a connectivity test that has a failed action and parse out.xml using the provided Python ElementTree command. Done when the report is well-formed XML and parses successfully with failure details preserved.

Written by the indexing model from the issue text.

Description

Summary

The JUnit XML report written by cilium connectivity test --junit-file is
malformed: <failure> elements carry the failureMessage attribute twice,
so strict XML parsers reject the file and JUnit consumers cannot use it.

Environment

  • cilium-cli: v0.19.7 compiled with go1.26.5 on linux/amd64
  • server: Cilium chart 1.20.4 on single-node k3d (k3s v1.34.5+k3s1)
  • command: cilium connectivity test --single-node --junit-file out.xml
    (any run with at least one failed action reproduces it; 132 testcases,
    27 failed in the reporting run)

Reproduction

  1. Run cilium connectivity test --junit-file out.xml on a setup where at
    least one test action fails (e.g. single-node k3d, L7/TLS tests fail).

  2. Parse the report with a strict parser:

    python3 -c "import xml.etree.ElementTree as ET; ET.parse('out.xml')"
    

Expected

Well-formed XML that any JUnit consumer can parse.

Actual

xml.etree.ElementTree.ParseError: duplicate attribute: line 8, column 405

The emitting element looks like
<failure message="..." failureMessage="..." failureMessage="...">
(the attribute appears twice with the full command text). Related work that
is NOT this bug: #40035 (export detailed failure messages, likely origin of
the second attribute), #46835 (atomic write), #46101 (remove partial file).

Additional Context

  • Probable source: cilium-cli/connectivity/internal/junit/junit.go
    (failure attributes are assembled in more than one place since #40035).
  • Workaround for consumers: regex-extract name/time per testcase
    instead of parsing the XML.
Dominant language
Makefile
Stars
612
Forks
228
Avg merge
19h 55m
Merged PRs (30d)
21

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cilium/cilium-cli

All issues in cilium/cilium-cli

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.