[Go] My tests time out in CircleCI but not when run locally

Tests on my Go project are timing out mostly, but not always, when run from CircleCI (and TravisCI). When I run the tests locally they always succeed.

CircleCI dashboard: https://circleci.com/gh/porjo/braid
Git Repo: https://github.com/porjo/braid/

My test spawns a web server (http/httptest) which it connects back to, so I’m guessing there’s some kind of network issue perhaps?

Any ideas where I’ve gone wrong?

There’s not much to critique in your config file, so I’d suggest debugging on the server.

You can get an SSH session on a failing build, and run the tests from the console. I’d suggest using Nano or some other console editor to make changes to your tests (e.g. add debug statements) to see what is going on.

Check that you are waiting for your server to become available before using it - you may have a race condition if you are starting it in the background. Or you might be listening on the wrong IP/interface (though I’d doubt this if they sometimes work).

I would assume you’d need to modify the file and recompile it in the console for Go.

Thanks, that’s what it turned out to be! I needed a mutex around some shared variables :frowning:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.