test(17-06): read -short through testing.Short in the Postgres harnesses
go test passes -test.short=true, so scanning os.Args for -test.short never matched and every -short run started a Postgres container. The three TestMains now parse the flags and ask testing.Short.
This commit is contained in:
@@ -3,6 +3,7 @@ package updates
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"flag"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
@@ -43,13 +44,11 @@ func TestMain(m *testing.M) {
|
||||
os.Exit(code)
|
||||
}
|
||||
|
||||
// testShort reports -short. go test passes -test.short=true, so the flags
|
||||
// are parsed and read through testing.Short, never by scanning os.Args.
|
||||
func testShort() bool {
|
||||
for _, a := range os.Args {
|
||||
if a == "-test.short" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
flag.Parse()
|
||||
return testing.Short()
|
||||
}
|
||||
|
||||
func startJournalPostgres(ctx context.Context) error {
|
||||
|
||||
Reference in New Issue
Block a user