From 1eaf76d711c2da04b925f381d77fbb5e4c7ed898 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 2 Dec 2015 21:26:31 +0000 Subject: Check for libpq thread safety, disable libcrypto init (fixes crashes with multiple ssl connections) add test --- libpqpp/unittests/testpq.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libpqpp/unittests') diff --git a/libpqpp/unittests/testpq.cpp b/libpqpp/unittests/testpq.cpp index 5dc4b2d..002b18c 100644 --- a/libpqpp/unittests/testpq.cpp +++ b/libpqpp/unittests/testpq.cpp @@ -10,6 +10,7 @@ #include #include #include "../error.h" +#include "../connection.h" class StandardMockDatabase : public PQ::Mock { public: @@ -175,3 +176,13 @@ BOOST_AUTO_TEST_CASE( connfail ) BOOST_REQUIRE_THROW(DB::ConnectionFactory::createNew("postgresql", "host=localhost user=no"), PQ::ConnectionError); } +BOOST_AUTO_TEST_CASE( ssl ) +{ + auto conn = DB::ConnectionFactory::createNew("postgresql", "host=randomdan.homeip.net user=gentoo dbname=postgres sslmode=require"); + BOOST_REQUIRE(conn); + auto pqconn = dynamic_cast(conn); + BOOST_REQUIRE(pqconn); + BOOST_REQUIRE(PQgetssl(pqconn->conn)); + delete conn; +} + -- cgit v1.2.3