You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running ./all.bash, it's not clear whether the postgres tests are running or not. Users will just see that tests succeeded, even when the change results in postgres failures. For example, here's./all.bash output on the same patchset:
Provide users with an option to skip postgres tests
When running ./all.bash, first check if we can connect to the test databases, before running tests. If not, exit and inform users about the option to bypass postgres tests.
Hmm, I'm not sure if I agree. This would once again break go test ./... on a clean clone.
It's true that some test successes are different from others, but that will generally be true for many other reasons. Some tests will require specific programs to be installed, or they might require Linux or Windows to run. Should all of those also fail unless they're actually running properly?
I think you should go the other way around. In all.bash, also run by CI, you could ensure that none of the portable tests are being skipped. You could do this with something like:
NO_DB_SKIP=true go test ./...
and in the Go code to handle the case where the DB isn't available:
if noDB {
if os.Getenv("NO_DB_SKIP") != "true" {
t.Fatal("some error")
}
t.Skip("skipping")
}
That way, you have the best of both worlds. It's possible for "run all the tests properly" to be done, and you're not messing with people who just want to run the tests on a best-effort basis.
A slight variant is what @bcmills suggested in the original issue, which is to make each TestMain start up a temporary postgres on-demand, and only do the skip-or-error dance when postgres isn't installed, which is less likely to be true than "postgres isn't running".
Follow up to #39598:
When running
./all.bash
, it's not clear whether the postgres tests are running or not. Users will just see that tests succeeded, even when the change results in postgres failures. For example, here's./all.bash
output on the same patchset:./all.bash
output with postgres setup:https://gist.github.com/julieqiu/c279934ee6054e7d5900274569c5c0d2
./all.bash
output without postgres setup:https://gist.github.com/bharaththiruveedula/dcfb9770fe99b3ecb8ee7891d8343631
I think we should do the following:
./all.bash
, first check if we can connect to the test databases, before running tests. If not, exit and inform users about the option to bypass postgres tests./cc @jba @mvdan @bharaththiruveedula
The text was updated successfully, but these errors were encountered: