Run some of the ci tests against a postgresql docker container

This commit is contained in:
louiz’
2017-12-03 16:46:14 +01:00
parent 6dc49f3284
commit 24dc05dd97
5 changed files with 44 additions and 5 deletions
+17 -2
View File
@@ -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());