tag:help.appveyor.com,2012-11-13:/discussions/problems/3940-appveyor-test-service-erroringAppVeyor: Discussion 2018-10-19T08:17:41Ztag:help.appveyor.com,2012-11-13:Comment/388345942016-01-05T16:20:23Z2016-01-05T16:20:23ZAppVeyor test service erroring<div><p>Hi James,<br>
Do you get this error every time you send such request?</p>
<p>-Feodor</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388345942016-01-05T18:50:48Z2016-01-05T18:50:49ZAppVeyor test service erroring<div><p>It failed 4 builds in a row before I gave up retrying, although
the test it<br>
failed on changed with each build.</p></div>James Newton-Kingtag:help.appveyor.com,2012-11-13:Comment/388345942016-01-05T18:52:06Z2016-01-05T18:52:06ZAppVeyor test service erroring<div><p>How do you send request to API?</p>
<p>-Feodor</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388345942016-01-05T18:54:39Z2016-01-05T18:54:39ZAppVeyor test service erroring<div><p>I don't call it myself, I'm running tests with xUnit and it
is<br>
automatically calling it. You can see its name against the
TestFramework<br>
property in the error message's JSON.</p></div>James Newton-Kingtag:help.appveyor.com,2012-11-13:Comment/388345942016-01-05T18:57:16Z2016-01-05T18:57:16ZAppVeyor test service erroring<div><p>Can you drop a link to a build please?</p>
<p>-Feodor</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388345942016-01-05T18:58:58Z2016-01-05T18:58:58ZAppVeyor test service erroring<div><p><a href="https://ci.appveyor.com/project/JamesNewtonKing/newtonsoft-json/build/1.0.591">
https://ci.appveyor.com/project/JamesNewtonKing/newtonsoft-json/bui...</a></p></div>James Newton-Kingtag:help.appveyor.com,2012-11-13:Comment/388345942016-01-05T19:10:07Z2016-01-05T19:10:07ZAppVeyor test service erroring<div><p>If you re-run <a href="https://ci.appveyor.com/project/JamesNewtonKing/newtonsoft-json/build/1.0.587">
https://ci.appveyor.com/project/JamesNewtonKing/newtonsoft-json/bui...</a>
build - would it work?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388345942016-01-05T19:30:52Z2016-01-05T19:30:52ZAppVeyor test service erroring<div><p>It passed. Did you change anything? If it is a transient error
you should<br>
add some logging to figure out why it is happening and how
often.</p></div>James Newton-Kingtag:help.appveyor.com,2012-11-13:Comment/388345942016-01-05T19:42:15Z2016-01-05T19:42:15ZAppVeyor test service erroring<div><p>Nope, I changed nothing.</p>
<p>It would be nice to reproduce this error though. Looking at your
logs it's "all or nothing" and fails on the first test or all tests
pass. Is it DNX runner?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388345942016-01-05T19:44:06Z2016-01-05T19:44:06ZAppVeyor test service erroring<div><p>Yes.</p></div>James Newton-Kingtag:help.appveyor.com,2012-11-13:Comment/388345942016-01-05T20:03:40Z2016-01-05T20:03:40ZAppVeyor test service erroring<div><p>OK, will give it a try. Theoretically, it should fail on a
simple build with just one test only.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388345942016-01-08T22:39:50Z2016-01-08T22:39:50ZAppVeyor test service erroring<div><p>I've still intermediately getting this error:<br>
<a href="https://ci.appveyor.com/project/JamesNewtonKing/newtonsoft-json/build/1.0.594">
https://ci.appveyor.com/project/JamesNewtonKing/newtonsoft-json/bui...</a></p></div>James Newton-Kingtag:help.appveyor.com,2012-11-13:Comment/388345942016-01-08T22:59:13Z2016-01-08T22:59:13ZAppVeyor test service erroring<div><p>I haven't looked into that yet. I suspect it might be something
with xUnit DNX runner or the way it's called during the build. It
would be very helpful to have a few very simple xUnit tests in a
public repo with a build script calling DNX runner.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388345942016-01-08T23:39:05Z2016-01-08T23:39:05ZAppVeyor test service erroring<div><p>OK, could you please add the following script before calling
your tests. It does 2 HTTP requests (similar to DNX runner ones)
directly to build worker API: one adding test and the second one
marking it as passed. If calling this script works while DNX runner
fails then it'd help narrow down the issue.</p>
<pre>
<code>$body = '{
"testName": "Newtonsoft.Json.Tests.Documentation.Samples.Xml.ConvertJsonToXml.Example123",
"testFramework": "xUnit",
"fileName": "Newtonsoft.Json.Tests.dll",
"outcome": "Running",
"DurationMilliseconds": null,
"ErrorMessage": null,
"ErrorStackTrace": null,
"StdOut": null,
"StdErr": null
}'
$headers = @{
"Content-type" = "application/json"
}
Invoke-WebRequest -Uri "$($env:appveyor_api_url)api/tests" -Headers $headers -Method Post -Body $body
Start-Sleep -s 1
$body = '{
"testName": "Newtonsoft.Json.Tests.Documentation.Samples.Xml.ConvertJsonToXml.Example123",
"outcome": "Passed",
"DurationMilliseconds": 100
}'
Invoke-WebRequest -Uri "$($env:appveyor_api_url)api/tests" -Headers $headers -Method Put -Body $body</code>
</pre>
<p>Alternatively, you can call this script on "Build failure"
step.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388345942016-01-21T19:33:05Z2016-01-21T19:33:05ZAppVeyor test service erroring<div><p>Hi James,</p>
<p>While working on some real-time logging improvements in Build
Agent I revisited the issue with DNX runner. With updated build
agent fail rate looks better now: <a href="https://ci.appveyor.com/project/FeodorFitsner/newtonsoft-json/history">
https://ci.appveyor.com/project/FeodorFitsner/newtonsoft-json/history</a></p>
<p>However, sometimes there is still "A task was cancelled"
exception. I found the place where it comes from. It's
AppVeyorClient in logging reporter: <a href="https://github.com/xunit/xunit/blob/fe8d78df7cfec55ddab93c29ea96b0032ca998a8/src/xunit.runner.reporters/AppVeyorClient.cs#L44">
https://github.com/xunit/xunit/blob/fe8d78df7cfec55ddab93c29ea96b00...</a></p>
<p>I think 10 seconds is too optimistic and we can try increasing
it to at least 30 seconds.<br>
Also, I noticed it always errors in different places, different
test, but after being able to send to AppVeyor one test only. There
must be some sort of buffering of test results.</p>
<p>I've submitted a PR for now: <a href="https://github.com/xunit/xunit/pull/738">https://github.com/xunit/xunit/pull/738</a></p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388345942016-01-21T22:28:24Z2016-01-21T22:28:25ZAppVeyor test service erroring<div><p>Thanks for figuring this out.</p></div>James Newton-King