File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use tokio_core::reactor::Core;
4
4
5
5
use super :: * ;
6
6
use error:: { Error , ConnectError , SqlState } ;
7
+ use params:: ConnectParams ;
7
8
8
9
#[ test]
9
10
fn basic ( ) {
@@ -164,3 +165,21 @@ fn transaction() {
164
165
} ) ;
165
166
l. run ( done) . unwrap ( ) ;
166
167
}
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
+ }
You can’t perform that action at this time.
0 commit comments