Skip to content

Commit

Permalink
Update test_drop_on_broken to use BrokenConnectionManager
Browse files Browse the repository at this point in the history
  • Loading branch information
tneely committed Aug 28, 2024
1 parent 0e11232 commit bfe868e
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions bb8/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,27 +251,10 @@ async fn test_drop_on_broken() {
}
}

struct Handler;

#[async_trait]
impl ManageConnection for Handler {
type Connection = Connection;
type Error = Error;

async fn connect(&self) -> Result<Self::Connection, Self::Error> {
Ok(Default::default())
}

async fn is_valid(&self, _conn: &mut Self::Connection) -> Result<(), Self::Error> {
Ok(())
}

fn has_broken(&self, _: &mut Self::Connection) -> bool {
true
}
}

let pool = Pool::builder().build(Handler).await.unwrap();
let pool = Pool::builder()
.build(BrokenConnectionManager::<Connection>::new())
.await
.unwrap();
{
let _ = pool.get().await.unwrap();
}
Expand Down

0 comments on commit bfe868e

Please sign in to comment.