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