@@ -33,7 +33,7 @@ class PostgreSQLConnectionTests: XCTestCase {
33
33
for row in rows {
34
34
try XCTAssert (
35
35
row. firstValue ( forColumn: " typlen " ) ? . decode ( Int . self) == 1 ||
36
- row. firstValue ( forColumn: " typlen " ) ? . decode ( Int . self) == 2
36
+ row. firstValue ( forColumn: " typlen " ) ? . decode ( Int . self) == 2
37
37
)
38
38
}
39
39
}
@@ -261,7 +261,7 @@ class PostgreSQLConnectionTests: XCTestCase {
261
261
XCTAssertEqual ( createResult. count, 0 )
262
262
let insertResult = try client. query ( " insert into foo values ($1, $2); " , [
263
263
Int32 ( 1 ) , Hello ( message: " hello, world " )
264
- ] ) . wait ( )
264
+ ] ) . wait ( )
265
265
266
266
XCTAssertEqual ( insertResult. count, 0 )
267
267
let parameterizedResult = try client. query ( " select * from foo " ) . wait ( )
@@ -282,7 +282,7 @@ class PostgreSQLConnectionTests: XCTestCase {
282
282
let insertResult = try client. query ( " insert into nulltest (i, d) VALUES ($1, $2) " , [
283
283
PostgreSQLData ( type: . int2, format: . binary, data: Data ( [ 0x00 , 0x01 ] ) ) ,
284
284
PostgreSQLData ( type: . timestamp, format: . binary, data: nil ) ,
285
- ] ) . wait ( )
285
+ ] ) . wait ( )
286
286
XCTAssertEqual ( insertResult. count, 0 )
287
287
let parameterizedResult = try client. query ( " select * from nulltest " ) . wait ( )
288
288
XCTAssertEqual ( parameterizedResult. count, 1 )
@@ -348,7 +348,7 @@ class PostgreSQLConnectionTests: XCTestCase {
348
348
let completionHandlerExpectation2 = expectation ( description: " final completion handler called " )
349
349
let notifyConn = try PostgreSQLConnection . makeTest ( )
350
350
let listenConn = try PostgreSQLConnection . makeTest ( )
351
- let channelName = " Foo "
351
+ let channelName = " Fooze "
352
352
let messageText = " Bar "
353
353
let finalMessageText = " Baz "
354
354
@@ -358,17 +358,16 @@ class PostgreSQLConnectionTests: XCTestCase {
358
358
} else if text == finalMessageText {
359
359
completionHandlerExpectation2. fulfill ( )
360
360
}
361
- } . catch ( { err in XCTFail ( " error \( err) " ) } )
361
+ } . catch ( { err in XCTFail ( " error \( err) " ) } )
362
362
363
363
try notifyConn. notify ( channelName, message: messageText) . wait ( )
364
364
try notifyConn. notify ( channelName, message: finalMessageText) . wait ( )
365
365
366
+ waitForExpectations ( timeout: defaultTimeout)
366
367
notifyConn. close ( )
367
368
listenConn. close ( )
368
- waitForExpectations ( timeout: defaultTimeout)
369
369
}
370
370
371
-
372
371
func testURLParsing( ) throws {
373
372
let databaseURL = " postgres://username:password@hostname.com:5432/database "
374
373
let config = try PostgreSQLDatabaseConfig ( url: databaseURL)
@@ -390,7 +389,7 @@ class PostgreSQLConnectionTests: XCTestCase {
390
389
( " testGH24 " , testGH24) ,
391
390
( " testNotifyAndListen " , testNotifyAndListen) ,
392
391
( " testURLParsing " , testURLParsing) ,
393
- ]
392
+ ]
394
393
}
395
394
396
395
extension PostgreSQLConnection {
@@ -406,7 +405,7 @@ extension PostgreSQLConnection {
406
405
let group = MultiThreadedEventLoopGroup ( numThreads: 1 )
407
406
let client = try PostgreSQLConnection . connect ( hostname: hostname, on: group) { error in
408
407
XCTFail ( " \( error) " )
409
- } . wait ( )
408
+ } . wait ( )
410
409
_ = try client. authenticate ( username: " vapor_username " , database: " vapor_database " , password: nil ) . wait ( )
411
410
return client
412
411
}
0 commit comments