mikepenz/action-junit-report

Error: Converting circular structure to JSON

Closed this issue · 9 comments

Hi,
thanks for this tool. I have been using it for sometime now, but recently it crashes on my builds, with error:

   Error: Converting circular structure to JSON
      --> starting at object with constructor 'Object'
      |     property 'testsuite' -> object with constructor 'Object'
      --- property '_parent' closes the circle

you can see for example full logs at this link, under the failing Publish Test Report.

Any idea of what might cause it?

Good day.

Can you please provide a sample junit xml export which highlights this problem?

hi,
thanks. I created a branch action-junit-issue where the problem is reproduced. I modified the GitHub Action to be able to export the needed xml files. For example, at the end of this action run report you can see the artifact SurefireReports with all the xml files from Surefire. Attached here as well:
SurefireReports.zip

Thank you for the additional details. will aim to look at it as soon as possible!

Thanks for the details, and sorry for the delayed response. Finally had time to look into this.

So I was debugging it, and there is indeed a corrupt XML file in your export (there may be more, stopped after this one):
.../e2e-tests/spring-graphql/target/surefire-reports/TEST-org.evomaster.e2etests.spring.graphql.db.tree.DbTreeEMTest.xml

Screenshot 2023-10-20 at 11 26 48

If you look into the file, it abruptly ends.

<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" version="3.0" name="org.evomaster.e2etests.spring.graphql.db.tree.DbTreeEMTest" time="11.288" tests="1" errors="0" skipped="0" failures="1">
  <testcase name="testEM" classname="org.evomaster.e2etests.spring.graphql.db.tree.DbTreeEMTest" time="10.131">
    <failure type="java.lang.AssertionError"><![CDATA[java.lang.AssertionError: WRONG COVERAGE: 41 > 26
	at org.evomaster.core.Main$Companion.initAndRun(Main.kt:244)
	at org.evomaster.core.Main.initAndRun(Main.kt)
	at org.evomaster.e2etests.utils.GraphQLTestBase.initAndRun(GraphQLTestBase.java:21)
	at org.evomaster.e2etests.spring.graphql.db.tree.DbTreeEMTest.testEM$lambda$0(DbTreeEMTest.kt:42)
	at org.evomaster.e2etests.utils.EnterpriseTestBase.lambda$null$4(EnterpriseTestBase.java:214)
	at org.evomaster.e2etests.utils.EnterpriseTestBase.handleFlaky(EnterpriseTestBase.java:409)
	at org.evomaster.e2etests.utils.EnterpriseTestBase.lambda$runTestHandlingFlaky$5(EnterpriseTestBase.java:210)
	at org.junit.jupiter.api.AssertTimeout.lambda$assertTimeoutPreemptively$2(AssertTimeout.java:102)
	at org.junit.jupiter.api.AssertTimeout.lambda$assertTimeoutPreemptively$4(AssertTimeout.java:138)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)
]]></failure>
    <system-out><![CDATA[

The next release will at least gracefully handle these, instead of failing: #969

I hope this resolves the problem for you. Please report back if there are additional items left

@mikepenz thanks. I will try it out once the next release is available

@arcuri82 that said, please also have a look into your testing framework. as at least that one XML file is corrupt.

@mikepenz I guess might be a bug in surefire Maven plugin or some weird thing in GitHub Action that killed the process running the JUnit tests