Reputation: 26054
I have a Kotlin project with Bazel with some JUnit5 tests that I run with:
bazel run //my_service:tests
and this is the output:
Test run finished after 1195 ms
[ 3 containers found ]
[ 0 containers skipped ]
[ 3 containers started ]
[ 0 containers aborted ]
[ 3 containers successful ]
[ 0 containers failed ]
[ 5 tests found ]
[ 0 tests skipped ]
[ 5 tests started ]
[ 0 tests aborted ]
[ 5 tests successful ]
[ 0 tests failed ]
5 tests successful. So far, so good. But when tests are run inside Bazel Docker container, I get this output:
Test run finished after 79 ms
[ 1 containers found ]
[ 0 containers skipped ]
[ 1 containers started ]
[ 0 containers aborted ]
[ 1 containers successful ]
[ 0 containers failed ]
[ 0 tests found ]
[ 0 tests skipped ]
[ 0 tests started ]
[ 0 tests aborted ]
[ 0 tests successful ]
[ 0 tests failed ]
As you see, no tests are found. Why?
I run tests inside container with these commands:
$ docker run -it -v $(pwd):/my_service --entrypoint "" l.gcr.io/google/bazel:2.2.0 /bin/bash
$ cd my_service
$ bazel run //my_service:tests
I'm using Bazel 2.2.0 in both, local and Docker image. Why am I not getting the same output?
Upvotes: 3
Views: 252
Reputation: 26054
I found the solution. That was really weird. I was using register_toolchains
rule, instead of kt_register_toolchain
. Silly me.
Upvotes: 3