Crates.io | db-pool |
lib.rs | db-pool |
version | 0.4.0 |
source | src |
created_at | 2024-03-23 21:34:04.50809 |
updated_at | 2024-09-05 00:25:18.947956 |
description | A thread-safe database pool for running database-tied integration tests in parallel |
homepage | |
repository | https://github.com/yasamoka/db-pool |
max_upload_size | |
id | 1183871 |
size | 525,348 |
A thread-safe database pool for running database-tied integration tests in parallel with:
Rather than simply providing a database connection pool that allows multiple connections to the same database, db-pool
maintains a pool of separate isolated databases in order to allow running database-tied tests in parallel. It also handles the lifecycles of those databases: whenever you pick a database out of the pool, you can be sure that the database is clean and ready to be used, and that no other tests are connected to the database you are using in any one test.
When running tests against a database-tied service, such as a web server, a test database is generally used. However, this comes with its own set of difficulties:
This leads to several issues when running tests serially:
When switching to parallel execution of tests, even more difficulties arise:
db-pool
takes care of all of these concerns while supporting multiple database types, backends, and connection pools.
Backend | Pool | Feature |
---|---|---|
diesel/mysql | r2d2 | diesel-mysql |
diesel/postgres | r2d2 | diesel-postgres |
mysql | r2d2 | mysql |
postgres | r2d2 | postgres |
Backend | Pool | Features |
---|---|---|
diesel-async/mysql | bb8 | diesel-async-mysql , diesel-async-bb8 |
diesel-async/mysql | mobc | diesel-async-mysql , diesel-async-mobc |
diesel-async/postgres | bb8 | diesel-async-postgres , diesel-async-bb8 |
diesel-async/postgres | mobc | diesel-async-postgres , diesel-async-mobc |
sea-orm/sqlx-mysql | sqlx | sea-orm-mysql |
sea-orm/sqlx-postgres | sqlx | sea-orm-postgres |
sqlx/mysql | sqlx | sqlx-mysql |
sqlx/postgres | sqlx | sqlx-postgres |
tokio-postgres | bb8 | tokio-postgres , tokio-postgres-bb8 |
tokio-postgres | mobc | tokio-postgres , tokio-postgres-mobc |