How to output the test command Ginkgo uses

603 Views Asked by At

I have a Ginkgo test suite that has many test files. I can run all tests under the test suite with the following command, where ./controller is the package that has all tests.

go test ./controllers/... -v --args --ginkgo.vv

say ./controller folder has the following files

add_pods.go
add_pods_test.go
update_status.go
update_status_test.go

I want to figure out how to run update_status_test.go alone. The go test ./controller -run update_status doesn't work because it cannot find any test.

Can I let ginkgo output the go test command it uses to run each test? That can give me hint on how to focus on a single test to run.

1

There are 1 best solutions below

1
Loïc Madiès On

Yes following to documentation (using ginkgo 1.16.5). Using options -x go test will display the go test command to run (-n go test also does it without running tests).

ginkgo help

...
-x go test
Have go test print the commands.
...
-n go test
Have go test print the commands but do not run them.