From 24dc05dd979264143223e166faa032e75f986b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 3 Dec 2017 16:28:38 +0100 Subject: Run some of the ci tests against a postgresql docker container --- tests/database.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/database.cpp b/tests/database.cpp index aeddea3..20a446b 100644 --- a/tests/database.cpp +++ b/tests/database.cpp @@ -1,14 +1,29 @@ #include "catch.hpp" +#include + +#ifdef USE_DATABASE + +#include + #include #include TEST_CASE("Database") { -#ifdef USE_DATABASE -// Database::open("postgresql://test"); +#ifdef PQ_FOUND + std::string postgresql_uri{"postgresql://"}; + const char* env_value = ::getenv("TEST_POSTGRES_URI"); + if (env_value != nullptr) + postgresql_uri += env_value; + else + postgresql_uri += "/test"; + Database::open(postgresql_uri); +#else Database::open(":memory:"); +#endif + Database::raw_exec("DELETE FROM " + Database::irc_server_options.get_name()); Database::raw_exec("DELETE FROM " + Database::irc_channel_options.get_name()); -- cgit v1.2.3