Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test packages with specific build tags #1465

Open
littleskew opened this issue Oct 7, 2024 · 1 comment
Open

Test packages with specific build tags #1465

littleskew opened this issue Oct 7, 2024 · 1 comment

Comments

@littleskew
Copy link

littleskew commented Oct 7, 2024

Hello!

It seems to me that there is a problem with running test packages with specific build tags.

I have ginkgo specs in one of my packages and I'm trying to run tests in packages with specific build tags. When I'm doing it with go test -tags=my_tag ./... then only tests of underlying packages with the tag //go:build my_tag are run. But when I use ginkgo -v -tags=my_tag ./... or ginkgo build -tags=my_tag ./... then somewhy Ginkgo is trying to compile all packages with different build tags and fails with the error:

Failed to compile mypackage:
package /test/mypackage: build constraints exclude all Go files in /Users/testuser/go/src/test/mypackage
.... 

Ginkgo ran 12 suites in 3.456281959s (even though I have only one package with that tag)

There were failures detected in the following suites:
          mypackage ./test/mypackage [Compilation failure]

Is it expected and I am doing something wrong or is it an existing issue?

This also happens if running ginkgo without tags flag but on ./... packages and some of the underlying packages have build tags.

Thanks in advance!

@onsi
Copy link
Owner

onsi commented Oct 29, 2024

hey, sorry for the delay. yeah Ginkgo won't filter out the packages when run with tags. It simply passes tags to the go compiler. In the case wehre a package is entirely ruled out by the tag rules this will result in a non-existent package and Ginkgo will fail. I don't have a great answer for you other than to use -tags in tandem with -skip-package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants