Function merino_integration_tests::utils::redis::get_temp_db
source · [−]pub async fn get_temp_db(
connection_info: &ConnectionInfo
) -> Result<(ConnectionInfo, Object<i64>)>
Expand description
Get a connection info that uses an unused database on the Redis server.
To define “unused”, this assumes that no other programs are using Redis databases greater than 0. It is safe to run multiple tests in parallel within one test runner, but not to run multiple test runners.
The return value contains a connection info to use as normal, and a guard object. When the guard is dropped, the database used by that connection info is marked as available again. It is up to the caller to ensure that the connection info does not outlive the guard.