summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-12-03 16:28:38 +0100
committerlouiz’ <louiz@louiz.org>2017-12-03 16:46:14 +0100
commit24dc05dd979264143223e166faa032e75f986b21 (patch)
tree18b961acd175639b797be6ff7a9e59b62077af9c /tests
parent6dc49f32844b846bd9675ed6a9d669e266122276 (diff)
downloadbiboumi-24dc05dd979264143223e166faa032e75f986b21.tar.gz
biboumi-24dc05dd979264143223e166faa032e75f986b21.tar.bz2
biboumi-24dc05dd979264143223e166faa032e75f986b21.tar.xz
biboumi-24dc05dd979264143223e166faa032e75f986b21.zip
Run some of the ci tests against a postgresql docker container
Diffstat (limited to 'tests')
-rw-r--r--tests/database.cpp19
1 files changed, 17 insertions, 2 deletions
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 <biboumi.h>
+
+#ifdef USE_DATABASE
+
+#include <cstdlib>
+
#include <database/database.hpp>
#include <config/config.hpp>
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());