Open danadaldos opened 4 years ago
@danadaldos Thanks for your thorough report and investigation.
Without going deeply into the circleci tests
command, it does seem odd that the file name is missing from the data and likely to be required. I wonder if it's possible to create a smaller demonstration of this bug with just Elixir's junit-formatter
library, then if there isn't already been a fix in that library or at least a known issue.
My hunch is that this problem occurs between the formatter library being used here, and not the CLI. But I'm open to keeping this issue around in case anyone else has ideas.
Thanks again! :heart:
@zzak I forked the junit-formatter
library and added the necessary file
attribute to the <testcase>
s and it did fix the timings issue. I opened a PR on that library in order to allow people to configure junit-formatter
to include the file name.
I didn't want this to be an intrusive addition to junit-formatter
, so it is an optional configuration that defaults to false. If that gets merged into the library, maybe we can communicate on this demo app that split-by=timings
on Elixir needs the junit-formatter
and to have it configured to include_filename?: true
. I'll follow up when I hear back from the maintainers of that library.
Thank you!
@danadaldos Thanks so much for your contribution!
I'll follow up when I hear back from the maintainers of that library.
Sounds good, please feel free anytime if you'd like to add or change anything in our example apps or docs.
@zzak Okay, the owner of junit-formatter
merged the PR, so now if you configure that library with include_filename?: true
it will produce XML that has the filename and allows CircleCI to split-by=timings
. I created a documentation PR that explains these changes and how Elixir + CircleCI projects need to be configured.
Hey all,
I'm wanting to signal-boost an issue I have reported on CircleCI's forums (https://discuss.circleci.com/t/split-by-timings-on-elixir-project-fails-to-find-stored-timings-possibly-missing-file-names-in-junit-xml/34813)
Long story short, with the understanding that this demo project is NOT using the
split-by=timings
it seems like Elixir'sjunit-formatter
does not include afile
orfilename
attribute that other JUnit formatters for other languages do, and that that attribute might be required by CircleCI'ssplit --split-by=timings
utility.Here is a copy of the forum post:
Hey all,
I am trying to get
--split-by=timings
to work on an Elixir project but I keep getting the following error:When I SSH into a container, here's what the very end of
.circleci-task-data/circle-test-results/results.json
look like:Note that all of the test cases in that file have
"file":null
. ("files" seems to be an aggregation from the 4 containers I'm running (parallelism: 4
)I have compared notes with someone running a Ruby project, and the JSON in his test container looks like:
And, as noted in the sample, all of his test cases have a file name.
Now, I assume that
results.json
is created out of the JUnit formatter results that get saved as part of thestore_test_results
step in the build. Looking into the XML that gets stored after a build, and comparing notes again with the Ruby project, it appears that for Ruby/Rspec projects,RspecJunitFormatter
outputs XML that includes afile
attribute, whereas the XML outputted from Elixir's JUnit Formatter (https://github.com/victorolinasc/junit-formatter) does NOT have that field. Compare:rspec.xml
VS.
exunit.xml
Okay, so one includes file names, the other does not. CircleCI's
split
function has a--timings-type
flag that can be passed-in to tell the splitter to either look forfilename
orclassname
. However, adding--timings-type=classname
to the command does not fix the issue, instead, it causes a new error:Which leads me to believe that CircleCI's
split
utility requires a file name in the JUnit XML, which currently is not available in Elixir'sjunit-formatter
.Can someone confirm this or not? Am I missing something in my configuration?
Config.yml
For thoroughness, here are the relevant parts of my config file:
Other knowns:
Additionally, I would draw your attention to a comment made in the RspecJunitFormatter repo: https://github.com/sj26/rspec_junit_formatter/pull/70
Specifically the comment: