2

I'm using docker containers for some of my golang web service projects and part of the development workflow is using goconvey for some fast tdd feedback. I'd like to spin this up within a docker container and expose the port to the host machine so I can point my web browser to it and get coding.

We have compiled the goconvey binary and have popped it in /usr/local/bin The problem is that whenever I connect to the port exposed form the docker container I only get "404 Page not found" errors.

There are a few tweaks we have with out GOPATH specifically I'm vendoring my libs eg GOPATH=/proj-dir/vendor and code dev is happening in /src

I can get goconvey working nicely on my host but in the docker i'm stumped. The 404 suggest that I'm hitting the goconvey server but it does not serve up anything?

Any assistance appreciated.

Michael Whatcott
  • 5,603
  • 6
  • 36
  • 50
mcbain83
  • 492
  • 6
  • 19

1 Answers1

2

The goconvey server returns 404 when it cannot find the directory that contains the static resources.
The location of this directory depends on where go get stored the goconvey files, usually in

$GOPATH/src/github.com/smartystreets/goconvey

So in your docker container, ensure that goconvey is installed using the current $GOPATH value, and also verify that the /goconvey dir contains /web/client/... subdirectories, which is where the html, css, and js files for the Web UI reside.

(To test this, I renamed the client dir, which caused goconvey to return a plain 404 message.)

  • This looks like the correct answer... Haven't tried GoConvey in a docker container yet. – Michael Whatcott Jul 09 '15 at 21:27
  • Interesting, Just had a quick test now still seems to be serving up 404's. the goconvey binary is in /usr/local/bin and the GOPATH is set to looks at 2 directories (were vendoring the libs we import) so "/workspace:/workspace/vendor" the code lies in /workspace.. I confirmed that the files do lie in /workspace/vendor/src/github/smartystreets/goconvey/... – mcbain83 Jul 10 '15 at 05:46
  • 1
    After peeking into goconvey's sources, it would appear to me that goconvey takes a quite ad-hoc approach to find the static files. The code calls `runtime.Caller(0)` to get the path to its own .go file, then it appends /web/client. (See `func folders()` in goconvey.go, lines 47ff.) So assuming that you compiled goconvey with a different GOPATH than the current one, this would explain why it cannot find its static files. – Christoph Berger Jul 10 '15 at 08:47
  • Yup I recompiled the exe with the same GOPATH as my projects /vendor directory and it seems to work. Hummm is this ideal behaviour? - I also have noticed that the coverage reports don't seem to be serving up the correct files after they get regenerated...I have to delete them for it to serve up the new ones... not sure if this is related or not... – mcbain83 Jul 16 '15 at 09:20
  • Looks as if goconvey was not designed with GOPATH switching in mind. The chosen approach (that is, to assume that the current GOPATH contains the goconvey directories) may not be as flexible as it could be, but on the other hand, I think this helps to make goconvey so easy to install through a simple go get. – Christoph Berger Jul 16 '15 at 10:45