internal/test/integration: parse flags earlier

In some code paths, it was possible to call testing.Short() before flags
had been parsed. Fix this by calling
flag.Parse() earlier.

See https://build.golang.org/log/7f2caf626b9d159437f3d406a1e992ec9ada2c90
for an example failure.

Change-Id: If12e3257503cc5491cd35f379a1f9ff776868e93
Reviewed-on: https://go-review.googlesource.com/c/tools/+/576918
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Robert Findley 2024-04-05 15:15:27 -04:00
Родитель 4794229b8c
Коммит cb3eb43c5d
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -128,6 +128,8 @@ func Main(m *testing.M, hook func(*settings.Options)) {
}
testenv.ExitIfSmallMachine()
flag.Parse()
// Disable GOPACKAGESDRIVER, as it can cause spurious test failures.
os.Setenv("GOPACKAGESDRIVER", "off")
@ -141,8 +143,6 @@ func Main(m *testing.M, hook func(*settings.Options)) {
os.Exit(1)
}
flag.Parse()
runner = &Runner{
DefaultModes: DefaultModes(),
Timeout: *timeout,