zyborg / dotnet-tests-report

GitHub Action to run .NET Core tests and generate report attached to Workflow Run
MIT License
112 stars 36 forks source link

Invalid JSON for check run / results gist - build failure? #13

Open flexplate opened 3 years ago

flexplate commented 3 years ago

I'm seeing some strange behaviour with my test process. It runs my tests successfully and seems to generate an output, but then tries and fails to add a check run, citing invalid JSON:

Invoke-WebRequest: /home/runner/work/_actions/zyborg/dotnet-tests-report/v1.3.0/action.ps1:144
Line |
 144 |      Invoke-WebRequest -Headers $hdr $url -Method Post -Body ($bdy | C …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | {"message":"Problems parsing
     | JSON","documentation_url":"https://docs.github.com/rest/reference/checks#create-a-check-run"}

It also fails to create a results gist, with the same error at line 235.

I did notice it failed to build the solution, but since the tests ran successfully I'm not sure if this is related:

 Results File: /home/runner/work/geodesy-csharp/geodesy-csharp/_TMP/test-results.trx

Test Run Failed.
Total tests: 81
     Passed: 75
     Failed: 6
 Total time: 1.6010 Seconds
     3>Done Building Project "/home/runner/work/geodesy-csharp/geodesy-csharp/geodesy-test/geodesy-test.csproj" (VSTest target(s)) -- FAILED.
     1>Done Building Project "/home/runner/work/geodesy-csharp/geodesy-csharp/geodesy-csharp.sln" (VSTest target(s)) -- FAILED.

Build FAILED.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:05.25
Warning: Execution of tests returned failure: 1
TCBroad commented 3 years ago

I'm getting the same thing when I run tests for the whole solution (over 2000 tests). If I run smaller individual test suites it uploads successfully. Could be to do with the 64k character limit but I'm getting the exact error described above and not the one from #9

Edit to add - I have now tested it with a single large suite of tests and it fails to upload the check run or gist, so it isn't related to having multiple suites running.

image

image

ebekker commented 3 years ago

Can you try to disable the Check Run reports by enabling the skip_check_run flag, and then enabling Gist-based reports using the gist_name and gist_token inputs and see if you still get this error?

TCBroad commented 3 years ago

I get a similar error when it tries to create the gist:

image

ebekker commented 3 years ago

This isn't accessible on a public GitHub project by any chance, is it?

TCBroad commented 3 years ago

I'm afraid not but I might be able to help you out with bits of logs or any other info. Also happy to try any changes you might suggest - I did fork the repo but then had other work to do so never bothered investigating further.

ebekker commented 3 years ago

If you reduce the number of tests, does it also fix the call to create the Gist?

TCBroad commented 3 years ago

Yeah both work if I reduce the number of tests

On Tue, 6 Apr 2021, 18:43 Eugene Bekker, @.***> wrote:

If you reduce the number of tests, does it also fix the call to create the Gist?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zyborg/dotnet-tests-report/issues/13#issuecomment-814308573, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAORN47GQRHU2FHSXE5ILT3THNB3ZANCNFSM4XI5B63A .

ebekker commented 3 years ago

I was looking at the documentation for some indication of a limit on the payload for creating Gists, but it doesn't mention anything, I'll need to play around with it and see if I can nail it down.

In the mean time, could you possibly work around the issue by breaking your batch of 2000+ tests into several smaller batches? If you are categorizing, perhaps run each category as a separate batch with separate result reports?

flexplate commented 2 years ago

Apologies for bumping a 6-month old issue but I thought I'd give it another go since there have been multiple releases since last time I tried it. I can confirm that this issue still persists in 1.4.4 and that setting skip_check_run: true still raises the invalid JSON error:

Creating initial Tests Report Gist

Invoke-WebRequest: /home/runner/work/_actions/zyborg/dotnet-tests-report/v1.4.4/action.ps1:229
Line |
 229 |  … eGistResp = Invoke-WebRequest -Headers $apiHeaders -Uri $gistsApiUrl  …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | {"message":"Problems parsing
     | JSON","documentation_url":"https://docs.github.com/rest/reference/gists#create-a-gist"}