diff options
| author | Jonathan Amsterdam <jba@google.com> | 2021-02-18 18:59:14 -0500 |
|---|---|---|
| committer | Jonathan Amsterdam <jba@google.com> | 2021-02-19 12:42:19 +0000 |
| commit | bdbff71810517c1204374ab25b79368cc5631340 (patch) | |
| tree | 438ddf8ef653b574c50184ccf527a13ffb3586df /internal/postgres/postgres.go | |
| parent | de8e98b59d920fe96c313c72ff949f3b2be523d7 (diff) | |
| download | go-x-pkgsite-bdbff71810517c1204374ab25b79368cc5631340.tar.xz | |
internal/postgres: disable poller during postgres tests
I noticed that internal/postgres tests timed out in CI. From the
stack traces, it's possible that some deadlock with the poller is
implicated. I'm not sure, but just to rule it out, I'm disabling the
poller during tests.
Change-Id: I6f611ecdba28b176dd01f6e6c673a342086a1a5e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/293930
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>
Diffstat (limited to 'internal/postgres/postgres.go')
| -rw-r--r-- | internal/postgres/postgres.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/internal/postgres/postgres.go b/internal/postgres/postgres.go index 41fc4aa6..8d0defc8 100644 --- a/internal/postgres/postgres.go +++ b/internal/postgres/postgres.go @@ -36,6 +36,9 @@ func NewBypassingLicenseCheck(db *database.DB) *DB { return newdb(db, true) } +// For testing. +var startPoller = true + func newdb(db *database.DB, bypass bool) *DB { p := poller.New( []string(nil), @@ -46,8 +49,10 @@ func newdb(db *database.DB, bypass bool) *DB { log.Errorf(context.Background(), "getting excluded prefixes: %v", err) }) ctx, cancel := context.WithCancel(context.Background()) - p.Poll(ctx) // Initialize the state. - p.Start(ctx, time.Minute) + if startPoller { + p.Poll(ctx) // Initialize the state. + p.Start(ctx, time.Minute) + } return &DB{ db: db, bypassLicenseCheck: bypass, |
