Test fails on appveyor but works locally and elsewhere

gldraphael's Avatar

gldraphael

04 Oct, 2018 08:03 PM

Tests pass without hiccups locally (and within docker), but fail on AppVeyor for some reason. The test in question accesses a mongodb instance -- however the other tests that connect to mongodb pass without any problems.


Build: https://ci.appveyor.com/project/Galdin/evlog/build/0.1.26
Source: https://github.com/gldraphael/evlog
PR: https://github.com/gldraphael/evlog/pull/58

  1. Support Staff 1 Posted by Ilya Finkelshte... on 06 Oct, 2018 12:57 AM

    Ilya Finkelshteyn's Avatar

    There is a race condition somewhere. Maybe in in xunit or in Kestrel. I don't think in Mongo DB.

    I forked your repo and was able to reproduce the problem. Enabling 4-core VMs fixed it. I am sure you local machine and "elsewhere" has more than 2 cores.

    It reminds me this case. However I was not able to workaround it with setting "parallelizeTestCollections": false in your xunit.runner.json. However it still can be an xunit issue (see links to discussions and solution in the support thread I mention).

    Another theory is that Web service exhausted connections. I am not very familiar with Kestrel, but I would recommend try wrapping HttpClient into using statement for it not to leave opened sessions. I am just speculating, but may be it can help.

  2. 2 Posted by gldraphael on 08 Oct, 2018 06:31 AM

    gldraphael's Avatar

    Hey, thank you for taking the time to investigate the issue.

    Another theory is that Web service exhausted connections. I am not very familiar with Kestrel, but I would recommend try wrapping HttpClient into using statement for it not to leave opened sessions. I am just speculating, but may be it can help.

    The http client is being disposed though. I've manually invoked client.Dispose() in the IDisposable fixture's Dispose(). xUnit invokes it like it should. EDIT: I tried using blocks but it still fails: Link

    Enabling 4-core VMs fixed it. I am sure you local machine and "elsewhere" has more than 2 cores.

    I'm not entirely sure it's the cores -- the test pass on docker when the number of CPUs is set to 2. Number of CPU and cores mean the same thing, right?

    I'll try running the docker build on appveyor to see if that passes.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac