From cff5f578726bd016718e84ab5facd356bfec8066 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Mon, 21 Aug 2023 14:13:08 -0400 Subject: [PATCH] Update to latest tokio-postgres break (#830) --- Cargo.lock | 14 ++++++++++---- martin/src/pg/tls.rs | 9 +++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44811911..6cf20d38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2339,9 +2339,9 @@ dependencies = [ [[package]] name = "postgres" -version = "0.19.5" +version = "0.19.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bed5017bc2ff49649c0075d0d7a9d676933c1292480c1d137776fb205b5cd18" +checksum = "2843af30d9b6dccec9f8779eb50d56cfbec54b38c7b1bbaf50b37d6c8a4f8959" dependencies = [ "bytes", "fallible-iterator", @@ -3558,9 +3558,9 @@ dependencies = [ [[package]] name = "tokio-postgres" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e89f6234aa8fd43779746012fcf53603cdb91fdd8399aa0de868c2d56b6dde1" +checksum = "000387915083ea6406ee44b50ca74813aba799fe682a7689e382bf9e13b74ce9" dependencies = [ "async-trait", "byteorder", @@ -3575,9 +3575,11 @@ dependencies = [ "pin-project-lite", "postgres-protocol", "postgres-types", + "rand", "socket2 0.5.3", "tokio", "tokio-util", + "whoami", ] [[package]] @@ -3945,6 +3947,10 @@ name = "whoami" version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" +dependencies = [ + "wasm-bindgen", + "web-sys", +] [[package]] name = "winapi" diff --git a/martin/src/pg/tls.rs b/martin/src/pg/tls.rs index 99c1ed2e..96e0ac35 100644 --- a/martin/src/pg/tls.rs +++ b/martin/src/pg/tls.rs @@ -128,12 +128,13 @@ mod tests { #[test] fn test_parse_conn_str() { - let (cfg, mode) = parse_conn_str("postgresql://localhost:5432").unwrap(); + let (cfg, mode) = + parse_conn_str("postgresql://user:password@localhost:5432/dbname").unwrap(); assert_eq!(cfg.get_hosts(), &vec![Host::Tcp("localhost".to_string())]); assert_eq!(cfg.get_ports(), &vec![5432]); - assert_eq!(cfg.get_user(), None); - assert_eq!(cfg.get_dbname(), None); - assert_eq!(cfg.get_password(), None); + assert_eq!(cfg.get_user(), Some("user")); + assert_eq!(cfg.get_dbname(), Some("dbname")); + assert_eq!(cfg.get_password(), Some(b"password".as_ref())); assert_eq!(cfg.get_ssl_mode(), SslMode::Prefer); assert_eq!(mode, SslModeOverride::Unmodified(SslMode::Prefer));