Summary
Currently, userver's testing story has a gap when it comes to testing code that depends on real external services (PostgreSQL, MongoDB, Redis, etc.):
- Unit tests (utest) require mocks that may diverge from real service behavior
- Functional tests (testsuite) require pre-installed database binaries on the host system, which makes them impractical in many environments
This feature request is to provide utest integration with testcontainers-native - the C/C++ adapter for Testcontainers - so that developers can spin up real services via Docker directly from utest-based tests, without any pre-installed binaries.
Motivation
A common complaint from the userver community (paraphrased from community discussions):
"I really miss being able to work with Docker instead of binaries. Because setting it up is so much work, I end up writing unit tests with mocks instead. Testsuite doesn't work out of the box for me - I have no PostgreSQL, MongoDB or other DB binaries locally, especially not multiple versions that might match the production environment. Running via devcontainer might be the only option, but even then you're locked to fixed versions." (https://t.me/userver_ru/80631)
Desired outcome
A way to start real Docker-based services (PostgreSQL, Redis, MongoDB, or any arbitrary image) from within a UTEST_F fixture, with proper lifecycle management (start before test, stop after), ideally with connection string helpers for services that userver natively supports.
References
Summary
Currently, userver's testing story has a gap when it comes to testing code that depends on real external services (PostgreSQL, MongoDB, Redis, etc.):
This feature request is to provide utest integration with testcontainers-native - the C/C++ adapter for Testcontainers - so that developers can spin up real services via Docker directly from utest-based tests, without any pre-installed binaries.
Motivation
A common complaint from the userver community (paraphrased from community discussions):
Desired outcome
A way to start real Docker-based services (PostgreSQL, Redis, MongoDB, or any arbitrary image) from within a
UTEST_Ffixture, with proper lifecycle management (start before test, stop after), ideally with connection string helpers for services that userver natively supports.References