internal/fetch: fix local-only test
Fix so that TestFetchModule no longer fails if only local tests are
run.
Change-Id: I44a5c84b409cfe8dd11962f4c69ec02afdb941a4
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/279462
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
diff --git a/internal/fetch/fetch_test.go b/internal/fetch/fetch_test.go
index 35025a0..f359f8b 100644
--- a/internal/fetch/fetch_test.go
+++ b/internal/fetch/fetch_test.go
@@ -56,6 +56,7 @@
mod *testModule
fetchVersion string
proxyOnly bool
+ cleaned bool
}{
{name: "basic", mod: moduleNoGoMod},
{name: "wasm", mod: moduleWasm},
@@ -98,9 +99,9 @@
if got.Error != nil {
t.Fatal("fetching failed: %w", got.Error)
}
-
- if fetcher.name == "proxy" {
+ if !test.cleaned {
test.mod.fr = cleanFetchResult(t, test.mod.fr, d)
+ test.cleaned = true
}
fr := updateFetchResultVersions(t, test.mod.fr, fetcher.name == "local")
sortFetchResult(fr)