Skip to content

Commit bbb7c1c

Browse files
authored
Make tests respect the LOG_LEVEL env var. Also fix auth failure test with Postgres 12 (vapor#106)
1 parent 25aa31f commit bbb7c1c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Tests/PostgresNIOTests/PostgresNIOTests.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ final class PostgresNIOTests: XCTestCase {
627627
XCTAssertThrowsError(_ = try auth.wait()) { error in
628628
guard let postgresError = try? XCTUnwrap(error as? PostgresError) else { return }
629629

630-
XCTAssertEqual(postgresError.code, .invalidPassword)
630+
XCTAssert(postgresError.code == .invalidPassword || postgresError.code == .invalidAuthorizationSpecification)
631631
}
632632
}
633633

@@ -916,10 +916,14 @@ final class PostgresNIOTests: XCTestCase {
916916
}
917917
}
918918

919+
func env(_ name: String) -> String? {
920+
getenv(name).flatMap { String(cString: $0) }
921+
}
922+
919923
let isLoggingConfigured: Bool = {
920924
LoggingSystem.bootstrap { label in
921925
var handler = StreamLogHandler.standardOutput(label: label)
922-
handler.logLevel = .debug
926+
handler.logLevel = env("LOG_LEVEL").flatMap { Logger.Level(rawValue: $0) } ?? .debug
923927
return handler
924928
}
925929
return true

0 commit comments

Comments
 (0)