Skip to main content

toasty_driver_integration_suite/tests/
infra_pool_config.rs

1use std::time::Duration;
2
3use crate::prelude::*;
4
5#[driver_test(
6    requires(test_connection_pool),
7    scenario(crate::scenarios::user_with_age)
8)]
9pub async fn max_pool_size_is_applied(t: &mut Test) -> Result<()> {
10    let db = t
11        .setup_db_with(models!(User), |b| {
12            b.max_pool_size(7);
13        })
14        .await;
15
16    assert_eq!(db.pool().status().max_size, 7);
17
18    Ok(())
19}
20
21#[driver_test(scenario(crate::scenarios::user_with_age))]
22pub async fn pool_timeouts_are_accepted(t: &mut Test) -> Result<()> {
23    // The values are not directly observable through the public API; this
24    // test confirms the builder accepts them and a connection can still be
25    // acquired.
26    t.setup_db_with(models!(User), |b| {
27        b.pool_wait_timeout(Some(Duration::from_millis(500)));
28        b.pool_create_timeout(Some(Duration::from_secs(2)));
29    })
30    .await;
31
32    Ok(())
33}