DEV Community

Dênis Mendes
Dênis Mendes

Posted on

Running Golang tests in docker container

Hi there!

I was trying to run a test with golang running in a docker container and I was stumbling into that message:

[no tests to run]

I figured out doing like that:

docker exec docker_golang_service_1 go test -run ./... golangservice.com/v1/src/tests

Explaining:

docker exec YOUR_CONTAINER_NAME go test -run ./... YOUR_MODULE_NAME+PATH_TO_YOUR_TEST_DIRECTORY

The ./... means running every test exist into directory.

That's it.

Discussion (0)