orlangure/gnomock

Question: using gnomock in CI/CD environment with go applications

KoduIsGreat opened this issue · 2 comments

How would one use gnomocks go interface in a ci/cd environment without using a docker in docker solution as many have pointed out the pitfalls of doing something like docker in docker
I'm aware that you can also use gnomock as a server for creating presets and starting them, but theres not much documentation on if those containers could be side car along side of a docker image running the tests and exposed via the docker network.

Hi,

Gnomock doesn't use docker-in-docker (except for k3s preset), it uses whatever docker daemon is available in the environment that calls gnomock.Start.

If your use case is to run go test from inside a container that you yourself create in CI, I suggest using a remote docker engine (with DOCKER_HOST environment variable, i.e DOCKER_HOST=172.17.0.1 go test), but you'll have to figure out which address to use so everything works smoothly.

Gnomock server is simply a wrapper that runs the same Gnomock code that uses the same docker daemon that is available, there is very little point (at least that was my intention) in using Gnomock server from Go. The server exists to expose Gnomock API to non-Go tests that can use the same automated setup by making simple HTTP calls.

If I misunderstood something, please clarify a little more about your case and the problems that you experience.

I'm going to close the issue since it's been a month since the last comment.