Skip to content

Commit d8aed09

Browse files
committed
Test unix sockets
1 parent e1de0c2 commit d8aed09

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

postgres-tokio/src/test.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use tokio_core::reactor::Core;
44

55
use super::*;
66
use error::{Error, ConnectError, SqlState};
7+
use params::ConnectParams;
78

89
#[test]
910
fn basic() {
@@ -164,3 +165,21 @@ fn transaction() {
164165
});
165166
l.run(done).unwrap();
166167
}
168+
169+
#[test]
170+
fn unix_socket() {
171+
let mut l = Core::new().unwrap();
172+
let handle = l.handle();
173+
let done = Connection::connect("postgres://postgres@localhost", &handle)
174+
.then(|c| c.unwrap().prepare("SHOW unix_socket_directories"))
175+
.and_then(|(s, c)| c.query(&s, &[]).collect())
176+
.then(|r| {
177+
let r = r.unwrap().0;
178+
let params = ConnectParams::builder()
179+
.user("postgres", None)
180+
.build_unix(r[0].get::<String, _>(0));
181+
Connection::connect(params, &handle)
182+
})
183+
.then(|c| c.unwrap().batch_execute(""));
184+
l.run(done).unwrap();
185+
}

0 commit comments

Comments
 (0)