-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
We're currently using a build constraint "integration" to prevent tests/integration from running when go test ./...
happens in CI (and locally). This is because integration tests are heavier-weight and meant to be run explicitly. They need some environment variables with tokens to be set, etc.
// +build integration |
The problem with that is that the code in that package is not included when one does go list ./...
(as opposed to go list -tags=integration ./...
), so doing things like go build ./...
, go vet ./...
, staticcheck ./...
, doesn't catch issues. As a result, the integration tests tend to get build errors (forgetting to update APIs), miss out on lint/vet/staticcheck fixes, etc.
I suggest we get rid of the build constraint and instead rely on skipping tests when necessary integration environment variables are not set (perhaps rename them to be more specific to go-github integration tests, rather than more generic, to avoid false matches).
Some example of this being done in Go standard library are:
- https://github.com/golang/go/blob/go1.7/src/cmd/go/go_test.go#L132
- https://github.com/golang/go/blob/go1.7/src/cmd/go/go_test.go#L1066
- https://github.com/golang/go/blob/go1.7/src/cmd/go/go_test.go#L2793-L2795
I don't see any downsides to doing that, are there any?