aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/stdlib_test.go
AgeCommit message (Collapse)Author
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-04-08internal/postgres,etc: finish MustInsertModule cleanupJonathan Amsterdam
Now that there are no callers of MustInsertModule, rename MustInsertModuleLatest to MustInsertModule. We can also remove MustInsertModuleLMV. Change-Id: Ieb554ee32696c168be4cc0a14ecece9f4c6b91b4 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/308271 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-04-07internal/postgres: use MustInsertModuleLatestJonathan Amsterdam
For most internal/postgres tests, update latest-version information when we insert a module. That is more like what actually happens on the worker, and some features now rely on it, so we should do it everywhere. Some tests still use a custom go.mod file, so we can't switch to MustInsertModuleLatest for those, because it uses a minimal go.mod file. Change-Id: Ie5030aee4ed9c837931fddb8757e37bf6373a8c7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/307871 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>
2021-02-12internal/postgres: parallelize testsJonathan Amsterdam
Run tests in parallel on separate databases. With four DBs, the time to run all the package's tests is cut in about half, from 50s to 25s (the time varies from run to run). Instead of a global variable holding a single DB, we set up a channel populated with DBs. Each test receives from the channel to get a DB to use, and sends it to the channel when done. Because a test may have to wait to get a DB, we can't set an individual timeout for some tests because acquiring the DB can take some time. Individual test timeouts aren't really important, because `go test` will time out the entire run after 10 minutes anyway. The only test that can't be run in parallel is TestSearch, because it reads metrics before and after each sub-test to compute a delta, thereby implicitly assuming that no other Search calls are running in parallel. Change-Id: Icb35dbd2f146e27d82d4eef81343cf9725252155 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/291449 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-02-11internal/postgres: add MustInsertModule for testingJonathan Amsterdam
Simplifies frequent calls to InsertModule. Change-Id: Iafcf5ec8d71eb9ab541ceecb2d85eb0d9b5119b1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/291269 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-12-14internal/postgres: move TestGetStdlib to stdlib_test.goJulie Qiu
Change-Id: I59b91e8785dfb0d0657b6285175c447b0ccdd119 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/277652 Run-TryBot: Julie Qiu <julie@golang.org> Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org>