You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thread 'pg_async::tests::test_init_db' panicked at 'could not get connection:TimedOut', crates/srv-storage/src/pg_async.rs:39:41
stack backtrace:0: rust_begin_unwind
at /rustc/065a1f5df9c2f1d93269e4d25a2acabbddb0db8d/library/std/src/panicking.rs:593:51:core::panicking::panic_fmt
at /rustc/065a1f5df9c2f1d93269e4d25a2acabbddb0db8d/library/core/src/panicking.rs:67:142:core::result::unwrap_failed
at /rustc/065a1f5df9c2f1d93269e4d25a2acabbddb0db8d/library/core/src/result.rs:1651:53:core::result::Result<T,E>::expect
at /rustc/065a1f5df9c2f1d93269e4d25a2acabbddb0db8d/library/core/src/result.rs:1033:234:srv_storage::pg_async::tests::test_init_db::{{closure}}
at ./src/pg_async.rs:39:24
Are you seeing any additional errors?
No additional error is shown.
Steps to reproduce
use diesel_async::{
pooled_connection::{bb8::Pool, bb8::PooledConnection,AsyncDieselConnectionManager},AsyncPgConnection,};pubtypeDbConnectionManger = AsyncDieselConnectionManager<AsyncPgConnection>;pubtypeDbPool = Pool<AsyncPgConnection>;pubtypeDbConnection<'a> = PooledConnection<'a,AsyncDieselConnectionManager<AsyncPgConnection>>;#[tracing::instrument()]pubasyncfninit_db(database_url:&str) -> DbPool{let mgr = AsyncDieselConnectionManager::<AsyncPgConnection>::new(database_url);Pool::builder().build(mgr).await.expect("could not build connection pool")}#[cfg(test)]mod tests {usesuper::init_db;use diesel::{prelude::*, sql_query, sql_types::Text};use diesel_async::RunQueryDsl;#[derive(QueryableByName)]structSqlVersion{#[diesel(sql_type = Text)]pubversion:String,}#[tokio::main]#[test]asyncfntest_init_db(){
dotenvy::dotenv().ok();let database_url = std::env::var("DATABASE_URL").expect("Expected DATABASE_URL to be set");let pool = init_db(database_url.as_str()).await;letmut conn = pool.get().await.expect("could not get connection");let version = sql_query("SELECT version()").get_result::<SqlVersion>(&mut conn).await;assert!(version.is_ok());let version = version.unwrap();println!("database version {}", version.version);}}
diesel = { version = "2.1.0", features = ["postgres", "r2d2"] }
diesel-async = { version = "0.3.1", features = ["postgres", "bb8"] }
Checklist
I have already looked over the issue tracker for similar possible closed issues.
This issue can be reproduced on Rust's stable channel. (Your issue will be
closed if this is not the case)
This issue can be reproduced without requiring a third party crate
The text was updated successfully, but these errors were encountered:
I've tried your minimal example locally and the tests passes for my setup. Additionally this issue indicates that this error also might be returned if your connection URL is somehow invalid. I agree that this error message is not optimal, but that's an issue in bb8 then.
Closed that I'm not able to reproduce the issue locally with a valid database URL.
I've checked your repo and I cannot reproduce the issue with that either. Both tests complete successful for me. Again I believe that this is just an issue with your database URL. Please note that diesel::PgConnection and diesel_async::AsyncPgConnection do not necessarily support the same database URL params/format. They are completely different implementations that support a different set of parameters. Just because a database URL works with one of the implementations it does not necessarily mean that it will work with the other implementation as well. Checkout the documentation of both types to learn about the required format.
Setup
Versions
rustc 1.72.0
Feature Flags
["postgres", "r2d2"]
["postgres", "bb8"]
Problem Description
Fail to get the connection,
TimedOut
What are you trying to accomplish?
Manager the connection with the
diesel-async
What is the expected output?
What is the actual output?
Are you seeing any additional errors?
No additional error is shown.
Steps to reproduce
Checklist
closed if this is not the case)
The text was updated successfully, but these errors were encountered: