MCPcopy Index your code
hub / github.com/riverqueue/river / TestDatabaseURL

Function TestDatabaseURL

rivershared/riversharedtest/riversharedtest.go:217–236  ·  view source on GitHub ↗

TestDatabaseURL returns `TEST_DATABASE_URL` or a default URL pointing to `river_test` and with suitable connection configuration defaults.

()

Source from the content-addressed store, hash-verified

215// TestDatabaseURL returns `TEST_DATABASE_URL` or a default URL pointing to
216// `river_test` and with suitable connection configuration defaults.
217func TestDatabaseURL() string {
218 return cmp.Or(
219 os.Getenv("TEST_DATABASE_URL"),
220
221 // 100 conns is the default maximum for Homebrew.
222 //
223 // It'd be nice to be able to set this number really high because it'd
224 // mean less waiting time acquiring connections in tests, but with
225 // default settings, contention between tests/test packages leading to
226 // exhausion on the Postgres server is definitely a problem. At numbers
227 // >75 I started seeing a lot of errors between tests within a single
228 // package, and worse yet, at numbers >=20 I saw major problems between
229 // packages (i.e. as parallel packages run at the same time).
230 //
231 // 15 is about as high as I found I could set it while keeping test runs
232 // stable. This could be much higher in areas where we know Postgres is
233 // configured with more allowed max connections.
234 "postgres://localhost:5432/river_test?pool_max_conns=15&sslmode=disable",
235 )
236}
237
238// TimeStub implements baseservice.TimeGeneratorWithStub to allow time to be
239// stubbed in tests.

Callers 15

Example_uniqueJobFunction · 0.92
Example_jobArgsHooksFunction · 0.92
Example_jobSnoozeFunction · 0.92
Example_subscriptionFunction · 0.92
Example_insertAndWorkFunction · 0.92
Example_periodicJobFunction · 0.92
Example_cronJobFunction · 0.92
Example_batchInsertFunction · 0.92
Example_resumableCursorFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…