testcontainers-go icon indicating copy to clipboard operation
testcontainers-go copied to clipboard

[Enhancement]: Couchbase container `context deadline exceeded` when reused

Open waroir20 opened this issue 7 months ago • 0 comments

Proposal

Why is it important?

Since Go's test context creates physically separated binaries between packages, re-using a created container directly using the testcontainer's framework is impossible; so to accomplish the same thing utilizing testcontainer's framework we can configure the GenericContainer with a fixed container name. This fixed container name then allows other test packages within an application to reference the already created container minimizing resource consumption and repeated start up cost.

Currently in applications with lots of tests/slow running tests this singleton couchbase container starts up and runs just fine when tests attempt to create their own container via Run but once the Admin user has been enabled by the first test, all subsequent tests fail with "init cluster: context deadline exceeded" because the http requests are failing with 401.

waroir20 avatar Mar 19 '25 15:03 waroir20