aboutsummaryrefslogtreecommitdiff
path: root/internal/worker/refetch_test.go
AgeCommit message (Collapse)Author
2026-03-25all: add LatestVersion to ModuleInfoEthan Lee
- Add LatestVersion field to internal.ModuleInfo and update tests accordingly. - Changed some test formatting to improve readability. Change-Id: I1238e54614ef276d219b31d125cd2cad6b5a66f7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/756901 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Auto-Submit: Ethan Lee <ethanalee@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2026-03-20internal: conditionally return documentation in GetUnitEthan Lee
- Large documentations blobs should avoid being returned unless explicitly requested. Add a WithDocsSource to enable retrieval of unit information without the large documentation source information. - This does not functionally change existing GetUnit callsites. Change-Id: Ie983b7eaeb61bb92f2716ae64a3d1e1ea738dbe2 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/756480 Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Auto-Submit: Ethan Lee <ethanalee@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-23internal: move UnitMeta.IsRedistributable to UnitMichael Matloob
Change-Id: Ia0a18df32d752f20b0400b47860638c7d0910eb7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/556435 Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
2024-01-22internal: move UnitMeta.Licenses to UnitMichael Matloob
Change-Id: If2b3c1acd4830948e2d134517608f89771a7abcb Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/555735 kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
2023-08-29internal/source: inject *http.Client into source.NewClientMichael Matloob
This removes the dependency from package source onto ochttp. The users of source.NewClient that want an ochttp.Transport can set the transport on the *http.Client. For golang/go#61399 Change-Id: Ifb7126c482f664ee5a359f594d9324f0fd90f8b2 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/523510 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com>
2023-08-23all: remove arbitrary hard-coded timeouts in testsBryan C. Mills
If a test times out, that implies that it got stuck on something. By default, the Go testing package dumps goroutines when its own timeout is passed, which prints a goroutine dump, helping to reveal what was stuck. Adding an arbitrary timeout on top of the testing package's own timeout is, in my experience, almost always counterproductive. If the arbitrary timeout catches a real hang, it causes the test to fail instead of dumping goroutines, making it much harder to see what was stuck. On the other hand, if the timeouts are set aggressively enough to make the test fail early, they are often too aggressive for CI testing, causing flakes that then have to be triaged on an ongoing basis. On balance, the value of saving a minute or two for developers who have introduced a hang is not worth the cost of suppressing debugging information and causing flakes that have to be triaged. Fixes #61556. For #59347. Change-Id: I0263d0d9b18283470f100e5a0155818b87b5312f Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/521837 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
2021-11-15internal/licenses: remove Metadata.OldCoverageJonathan Amsterdam
We don't need the OldCoverage field anymore. All DBs have only the new Coverage information. Change-Id: Ib2d8e0cdacdc2f7b6514a8a5310d6905be15136c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/363954 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-09-13internal: add frontend fetch sourceJulie Qiu
Frontend fetch requests now have a source=fetch query param. This query param will be used in the next CL to update module_version_states correctly. Change-Id: I658ccea9fba7583838f8ccf733e2862966aef86d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/348816 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-09-03internal/worker: add loadshedder to fetch testJonathan Amsterdam
Test fetching with an actual loadshedder. This will catch bugs like the one fixed by https://golang.org/cl/347109. Change-Id: I75de9eb22110466ddae8e9c7378844a68322c6c2 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347395 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-08-20internal,tests: delete symbol history experimentsJulie Qiu
Change-Id: If780b7339dfb415c2060dc1fc9f020a5af57665d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/343709 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-08-18internal/proxy/proxytest: proxy test codeJonathan Amsterdam
Most of the code in internal/proxy was only for testing. Move it to a separate package for clarity. Change-Id: Ie9d241bc8a12923b579a7dd69ae7b36aaa1fd42a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/343209 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>
2021-04-29internal/postgres: read only one doc source from DBJonathan Amsterdam
If GetUnit is passed a build context, it will read documentation source only for that build context. It still reads all the build context values, just only one serialized blob of file ASTs. This sped up getUnitWithAllFields by about 2x on net/http, using detail-stats against the staging DB from a local frontend. Change-Id: Ib8e988940b7f8f8ef2c270129c4338bb3d56b9eb Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/312269 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-04-21internal/postgres: remove do-not-insert-new-documentationJulie Qiu
Change-Id: I4b5e4b4e6556f6f724dd01c08b7014c30b10a2b3 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/310313 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-04-20internal: add do-not-insert-new-documentation to testsJulie Qiu
All tests that affect the documentation table are updated so that experiment do-not-insert-new-documentation is active. Change-Id: I3672a7b18e50bc1cbe4820efe0e6e13ff9687596 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/310811 Reviewed-by: Jonathan Amsterdam <jba@google.com> Trust: Julie Qiu <julie@golang.org>
2021-02-25internal: embed ModuleInfo into UnitMetaJonathan Amsterdam
UnitMeta had most of the fields of ModuleInfo, but did not embed it. Now that we have added four more fields to ModuleInfo for deprecation and retraction, it makes sense to embed it rather than duplicate those fields. For golang/go#43265 For golang/go#41321 Change-Id: I20e2b922b49c7873a5535745d644631123de37cd Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/296209 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>
2021-02-24internal/worker: call WithFetchDisabled soonerJonathan Amsterdam
Convert the proxy client to one which doesn't fetch at the beginning of the request, so we don't have to pass a boolean argument through several layers. For golang/go#44437 Change-Id: I0495b5673cc399a1cdc16349d53ba4a9a4ecc380 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/295889 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-02-17internal/sample: improve treatment of sample licensesJonathan Amsterdam
To avoid sharing between tests, which can lead to race conditions, create new sample license slices and structs each time we need them. This uncovered some problems in the postgres tests. - The UpsertModule test was changing the top-level module license, but didn't propagate that change through all the units. We sample.ReplaceLicense to address that. - The checkModule was filling in missing license with defaults, instead of the correct data. Change-Id: I6074914155eb33d6ed6882f81a9d57b20135e422 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/292929 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-02-12internal/worker: invalidate cacheJonathan Amsterdam
Invalidate the cache for a module after successfully inserting the latest version. Test it in internal/testing/integration. Fixes golang/go#44217 Change-Id: If37d033824472be75dc53f8efa5057b43a0ae55d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/291369 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-02-02many: allow for multiple documentations for a UnitJonathan Amsterdam
Change internal.Unit.Documentation from a single internal.Documentation to a slice, so that a Unit can have doc for multiple build contexts. However, don't use this ability yet: fetch takes only the first build context it finds, postgres inserts only the first, frontend renders only the first, etc. For golang/go#37232 Change-Id: I17fd1ff2378e0862c029c8077057c207001f6136 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/288217 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> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-01-13internal/licenses: rename Coverage fieldsJonathan Amsterdam
Coverage -> OldCoverage NewCoverage -> Coverage Change-Id: I05b41e1525700b3539dad9894b6b678f6c88c67d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/283653 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-12-21internal/worker: honor proxyfetch query paramJonathan Amsterdam
If the fetch handler sees the "proxyfetch" query param set to "off", it tells internal/fetch to disable fetching by the proxy. Change-Id: I1c9303f96f9249a5b420a73451551aba21d9d417 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/278953 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2020-12-21internal/worker: factor out FetchAndUpdateState argsJonathan Amsterdam
Move some common args to a struct. Change-Id: I4e500bc72f0cc622ec7641568beb5c7dbde1e69a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/278713 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2020-12-14internal: add fields to unit meta structJamal Carvalho
Adds HasGoMod and VersionType fields to the UnitMeta struct and ModFileURL and IsStableVersion to UnitMain to support the details section in the right sidebar. For golang/go#43129 Change-Id: Id605d27d6a421d7c5ff2afc39f4532b11e49ace6 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/277832 Reviewed-by: Julie Qiu <julie@golang.org> Trust: Julie Qiu <julie@golang.org> Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
2020-12-03internal/worker: fetch response shows resolved versionJonathan Amsterdam
The worker's /fetch endpoint now replies on success with a message that uses the resolved version of the module, not the requested one. Change-Id: Id48e624bb9d34a1a1fd2541c1b11956850faf14c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/274955 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>
2020-11-24internal: add WithMain field setJulie Qiu
The WithDocumentation, WithReadme and WithSubdirectories field set are replaced by WithMain, since the main page always requires all of that information. WithMain also returns NumImports and NumImportedBy. Change-Id: I15d8aa7a1332da78d5dee49b418d7773c87b115b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/271418 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-11-24internal/postgres: delete use of ExperimentUnitPageJulie Qiu
ExperimentUnitPage is no longer used by internal/postgres. Change-Id: I19a9f7953a87e559a4acdb5f4a3712f9b2a79f01 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/272609 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-11-24internal/{godoc,worker,fetch}: factor out doc rendering for testsJonathan Amsterdam
Add godoc.RenderPartsFromUnit to simplifying doc rendering for tests, add use it in internal/{worker,fetch}. Also remove other unused symbols. Change-Id: Ifeef2cf6088332a3e4496be47a86afde885ecc54 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/272790 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>
2020-11-24many: remove Documentation.HTMLJonathan Amsterdam
HTML is always generated from source, so the Documentation.HTML field is no longer necessary. Change-Id: I13cddbfbd983c8a2ff0cb9389e854887caadcc13 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/272509 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
2020-11-24internal/postgres: stop inserting documentation.htmlJonathan Amsterdam
HTML is now always generated from the source on the frontend, so we don't need to store it in the DB anymore. Change-Id: Iedbac3df0c298af1f0e9f01f3c08ccd267b76053 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/272508 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>
2020-09-30internal/worker: replace legacy structs in TestReFetchJulie Qiu
TestReFetch now uses Unit and UnitMeta instead of LegacyPackage and LegacyVersionedPackage. For golang/go#39629 Change-Id: I028c3b7900bb8259734aa694f60803fe158914f3 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258309 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-09-30internal/worker: split fetch_test.go into multiple filesJulie Qiu
fetch_test.go is split into fetch_test.go, fetcherror_test.go and refetch_test.go for readability. Pure code in motion. For golang/go#39629 Change-Id: Icaa60930d373c78055b3ee67ba4398c367d7ea13 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258306 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>