Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Captured test output is not properly escaped #1

Closed
ggiraldez opened this issue Nov 16, 2018 · 3 comments
Closed

Captured test output is not properly escaped #1

ggiraldez opened this issue Nov 16, 2018 · 3 comments

Comments

@ggiraldez
Copy link

ggiraldez commented Nov 16, 2018

The <system-out> tag which contains the raw captured output from a test is not properly escaped or wrapped in a <![CDATA[ ]]> section. This means the generated XML is invalid and cannot be parsed (eg. by CircleCI).

In my case, I'm running my tests through CircleCI and I have HikariCP logging:

...
18-11-16 15:22:28 erebus.local DEBUG [com.zaxxer.hikari.HikariConfig:1052] - dataSourceJNDI..................none
18-11-16 15:22:28 erebus.local DEBUG [com.zaxxer.hikari.HikariConfig:1052] - dataSourceProperties............{password=<masked>}
18-11-16 15:22:28 erebus.local DEBUG [com.zaxxer.hikari.HikariConfig:1052] - driverClassName.................none
...

CircleCI then complains with the message:

The following errors were encountered parsing test results:

kaocha/results.xml
    Unexpected close tag </system-out>; expected </masked>. at [row,col {unknown-source}]: [58,12]

As far as I can see, there's no provided way to escape the content using clojure.xml, but clojure.data.xml has a cdata function to wrap the content inside a <![CDATA[ ... ]]> element, and properly handles ]]> in the content.

@plexus
Copy link
Member

plexus commented Nov 17, 2018

This is shockingly broken behavior from clojure.xml, it really should entity-escape text nodes. I guess people don't really use clojure.xml/emit for real world stuff.

I'll have a patch out in a bit.

@plexus
Copy link
Member

plexus commented Nov 17, 2018

This is fixed in the latest release

;; deps.edn
lambdaisland/kaocha-junit-xml {:mvn/version "0.0-27"}

;; lein/boot
[lambdaisland/kaocha-junit-xml "0.0-27"]

Please try it out! Thanks.

@plexus plexus closed this as completed Nov 17, 2018
@ggiraldez
Copy link
Author

Works like a charm! Thanks for the quick response! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants