Commit 0283753
committed
cmd/go/internal/modfetch/codehost: fix flaky TestReadZip
In normal use by the go command, ReadZip always happens after Stat,
which makes sure that the relevant revision has been fetched to
local disk. But TestReadZip calls ReadZip directly, and ReadZip was not
ensuring that fetch had happened.
This made 'go test' pass (because other earlier tests had done Stat of
the hg test repo) but 'go test -run=ReadZip' fail by itself.
And on big enough machines, the tests that were doing the Stat
were running in parallel with ReadZip, causing non-deterministic
failures depending on whether the Stat completed before ReadZip started.
Fix the race by calling Stat directly in ReadZip, like we already do in ReadFile.
Fixes longtest builder flake.
Change-Id: Ib42f64876b7ef51d8148c616539b412b42f8b24e
Reviewed-on: https://go-review.googlesource.com/c/go/+/720280
Reviewed-by: David Chase <[email protected]>
Reviewed-by: Michael Matloob <[email protected]>
Reviewed-by: Michael Matloob <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>1 parent 4ebf295 commit 0283753
1 file changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
624 | 624 | | |
625 | 625 | | |
626 | 626 | | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
627 | 635 | | |
628 | 636 | | |
629 | 637 | | |
630 | 638 | | |
631 | 639 | | |
632 | 640 | | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | 641 | | |
637 | 642 | | |
638 | 643 | | |
| |||
0 commit comments