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

Support very large test results #231

Closed
ben-manes opened this issue Mar 6, 2022 · 23 comments · Fixed by #232
Closed

Support very large test results #231

ben-manes opened this issue Mar 6, 2022 · 23 comments · Fixed by #232

Comments

@ben-manes
Copy link

My project produces millions of test executions over a 2 hour build. I was hoping to use this action for a summary of the results, which would be a lightweight as just the counts at the suite level. Unfortunately the action failed with an out of memory error (exit code 137). Can the results be processed in a streaming fashion rather than read fully into memory, which avoids having a limit?

A possible workaround that I might try is to delete all the test methods prior to processing, e.g.

xml ed -L -d "/testsuite/*" test.xml
@EnricoMi
Copy link
Owner

EnricoMi commented Mar 6, 2022

This are 6.31 GB of test results, wow! Let me see what I can do ...

@ben-manes
Copy link
Author

haha, yes. I tried it on a local download and the cli tool crashed as it's not streaming either.

$ find . -type f -exec xml ed -L -d "/testsuite/*" {} \;
./TEST-com.github.benmanes.caffeine.cache.ExpirationTest.xml:124476.115: internal error: Huge input lookup
ache.testing.RemovalListeners$RejectingRemovalListener.onRemoval(RemovalListener

@EnricoMi
Copy link
Owner

EnricoMi commented Mar 6, 2022

Since you are running with check_run_annotations: none, you can safely remove all those <testcase> nodes under the root <testsuite>. The action takes the statistics from the <testsuite> and only needs the individual <testcase> nodes for annotations.

@ben-manes
Copy link
Author

yes, exactly. I need to find the right incantation of a shell command to do that. Something like this should work, though not quite right yet: find . -name "*.xml" -exec sh -c 'grep testsuite {} > {}' \;

@ben-manes
Copy link
Author

I think will do it as the preprocessing step.

find . -type f -name "*.xml" -exec sh -c 'grep testsuite {} > {}.out && mv {}.out {}' \;

closing and off to give it a try.

@EnricoMi
Copy link
Owner

EnricoMi commented Mar 6, 2022

Thanks for reporting, I am curious about any workaround that works for you.

@ben-manes
Copy link
Author

kicked off a job, but it will take ~2 hours for the full run.

@EnricoMi EnricoMi reopened this Mar 6, 2022
@EnricoMi
Copy link
Owner

EnricoMi commented Mar 6, 2022

Can you test the action from this branch:

uses: EnricoMi/publish-unit-test-result-action/composite@branch-xml-ignore-testcases

That should not require you modifying the XML files.

I may make this available through a new option. This branch is just a PoC.

@ben-manes
Copy link
Author

Sure, here's that job

@EnricoMi
Copy link
Owner

EnricoMi commented Mar 6, 2022

The first job looks ok, the parsing errors will go away when you point files to test result xml files only:

 files: '**/*.xml'

The reported 0 tests will go away when you rerun the second job (assuming it has the same output as the first job - hasn't finished yet). There is a fix in the branch that did not get picked up by the second job as I pushed it after your workflow started.

@ben-manes
Copy link
Author

I kicked off another job with that fix. 🙁

@EnricoMi
Copy link
Owner

EnricoMi commented Mar 6, 2022

And, as a side note: with matrix strategy, you have to give the jobs individual check_name (include ${{ matrix.java }}) so that you get two results, otherwise the two results will overwrite each other.

@ben-manes
Copy link
Author

ben-manes commented Mar 6, 2022

right, I intend to use an artifact and separate workflow_run job, but that only runs if on the master branch. So I inlined these for debugging.

@ben-manes
Copy link
Author

Looks like it attached to the examples workflow, oddly enough, but still got a nice summary.

Screen Shot 2022-03-06 at 3 18 50 PM

@EnricoMi
Copy link
Owner

EnricoMi commented Mar 6, 2022

Your browser is running on macOS, right? On Ubuntu, this renders nicer:
grafik
Amazing how different Github looks across OS.

@ben-manes
Copy link
Author

Yep, that looks much nicer. Odd as probably both on chrome?

@EnricoMi
Copy link
Owner

EnricoMi commented Mar 6, 2022

Here is Ubuntu Chrome:
grafik

@EnricoMi
Copy link
Owner

EnricoMi commented Mar 6, 2022

OK, so the branch works equally well, no need to preprocess the files then.

@EnricoMi
Copy link
Owner

EnricoMi commented Mar 7, 2022

This has been released as v1.31, available via v1.

@ben-manes
Copy link
Author

Thanks! I pushed the switch over to this new config option.

@EnricoMi
Copy link
Owner

EnricoMi commented Mar 7, 2022

Thanks for testing, I am watching that job.

@EnricoMi
Copy link
Owner

EnricoMi commented Mar 7, 2022

Yay, this worked:
image

Next run, the lowest row will disappear, only leaving the test row.

8.5m tests, this is definitively top 1 in this action's high score.

@ben-manes
Copy link
Author

This is great! I had to estimate counts before since it is so huge. 🙂

For this project the complexity is very high and beyond what I can mentally track. I decided to brute force testing was a good safety net, even if sometimes excessive. The ~2000 tests methods are parameterized to run for every valid configuration (a cartesian product of the specification constraints), which catches a lot of simple mistakes during development that happen only in some cases. One of those settings is the backing implementation, where Google's Guava is a reference to assert similar behavior. I also ported unit test suite from the jdk, eclipse, apache, and google to fill in gaps due to lack of imagination. I then throw in many static analyzers, etc in hopes of catching whatever remains. Adding features or tests for bug fixes inches those numbers further. All of that is to say that the project is too complex for my meager brain so I copped out and burn cpu cycles instead 😄

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

Successfully merging a pull request may close this issue.

2 participants