Commit 24dc05dd authored by louiz’'s avatar louiz’ 🐗

Run some of the ci tests against a postgresql docker container

parent 6dc49f32
......@@ -17,6 +17,7 @@ variables:
SYSTEMD: "-DWITH_SYSTEMD=1"
LIBIDN: "-DWITH_LIBIDN=1"
SQLITE3: "-DWITH_SQLITE3=1"
POSTGRESQL: "-WITH_POSTGRESQL=1"
#
## Build jobs
......@@ -27,10 +28,10 @@ variables:
tags:
- docker
script:
- "echo Running cmake with the following parameters: -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3}"
- "echo Running cmake with the following parameters: -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3} ${POSTGRESQL}"
- mkdir build/
- cd build/
- cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3}
- cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3} ${POSTGRESQL}
- make everything -j$(nproc || echo 1)
- make coverage_check -j$(nproc || echo 1)
artifacts:
......@@ -64,21 +65,27 @@ build:alpine:
build:1:
variables:
BOTAN: "-DWITHOUT_BOTAN=1"
POSTGRESQL: "-DWITHOUT_POSTGRESQL=1"
<<: *fedora_build
build:2:
variables:
UDNS: "-DWITHOUT_UDNS=1"
POSTGRESQL: "-DWITHOUT_POSTGRESQL=1"
<<: *fedora_build
build:3:
variables:
SQLITE3: "-DWITHOUT_SQLITE3=1"
TEST_POSTGRES_URI: "postgres@postgres/postgres"
services:
- postgres:latest
<<: *fedora_build
build:4:
variables:
SQLITE3: "-DWITHOUT_SQLITE3=1"
POSTGRESQL: "-DWITHOUT_POSTGRESQL=1"
BOTAN: "-DWITHOUT_BOTAN=1"
LIBIDN: "-DWITHOUT_LIBIDN=1"
<<: *fedora_build
......@@ -87,17 +94,27 @@ build:5:
variables:
SQLITE3: "-DWITHOUT_SQLITE3=1"
UDNS: "-DWITHOUT_UDNS=1"
TEST_POSTGRES_URI: "postgres@postgres/postgres"
services:
- postgres:latest
<<: *fedora_build
build:6:
variables:
BOTAN: "-DWITHOUT_BOTAN=1"
UDNS: "-DWITHOUT_UDNS=1"
POSTGRESQL: "-DWITHOUT_POSTGRESQL=1"
<<: *fedora_build
build:7:
variables:
UDNS: "-DWITHOUT_UDNS=1"
POSTGRESQL: "-DWITHOUT_POSTGRESQL=1"
<<: *fedora_build
build:8:
variables:
POSTGRESQL: "-DWITHOUT_POSTGRESQL=1"
<<: *fedora_build
......
......@@ -14,7 +14,7 @@ endif()
#
## Find optional instrumentation libraries that will be used in debug only
#
find_library(LIBASAN NAMES asan libasan.so.3 libasan.so.2 libasan.so.1)
find_library(LIBASAN NAMES asan libasan.so.4 libasan.so.3 libasan.so.2 libasan.so.1)
find_library(LIBUBSAN NAMES ubsan libubsan.so.0)
#
......
......@@ -1031,6 +1031,7 @@ void Bridge::send_room_history(const std::string& hostname, std::string chan_nam
(void)hostname;
(void)chan_name;
(void)resource;
(void)history_limit;
#endif
}
......
......@@ -1080,6 +1080,9 @@ void BiboumiComponent::on_irc_client_connected(const std::string& irc_hostname,
const auto local_jid = irc_hostname + "@" + this->served_hostname;
if (Database::has_roster_item(local_jid, jid))
this->send_presence_to_contact(local_jid, jid, "");
#else
(void)irc_hostname;
(void)jid;
#endif
}
......@@ -1089,6 +1092,9 @@ void BiboumiComponent::on_irc_client_disconnected(const std::string& irc_hostnam
const auto local_jid = irc_hostname + "@" + this->served_hostname;
if (Database::has_roster_item(local_jid, jid))
this->send_presence_to_contact(irc_hostname + "@" + this->served_hostname, jid, "unavailable");
#else
(void)irc_hostname;
(void)jid;
#endif
}
......
#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());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment