summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-12-12 23:23:18 +0100
committerlouiz’ <louiz@louiz.org>2017-12-12 23:37:08 +0100
commit53fc926dc847af55a13a6ac9ea852658b0b0ba4d (patch)
tree52906bbff8087d57670fb43d7c3decec7136e756
parentc3313d0d418cb2aaaf2226eb0a7729ef567b6afb (diff)
downloadbiboumi-53fc926dc847af55a13a6ac9ea852658b0b0ba4d.tar.gz
biboumi-53fc926dc847af55a13a6ac9ea852658b0b0ba4d.tar.bz2
biboumi-53fc926dc847af55a13a6ac9ea852658b0b0ba4d.tar.xz
biboumi-53fc926dc847af55a13a6ac9ea852658b0b0ba4d.zip
Only run the unit tests with postgresql if TEST_POSTGRES_URI env var is set
Even if we built with postgresql’s support
-rw-r--r--.gitlab-ci.yml11
-rw-r--r--tests/database.cpp9
2 files changed, 3 insertions, 17 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cd6b307..5a3c7fd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -65,13 +65,11 @@ 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:
@@ -92,7 +90,6 @@ build:4:
build:5:
variables:
- SQLITE3: "-DWITHOUT_SQLITE3=1"
UDNS: "-DWITHOUT_UDNS=1"
TEST_POSTGRES_URI: "postgres@postgres/postgres"
services:
@@ -103,21 +100,13 @@ 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
-
-
#
## Test jobs
#
diff --git a/tests/database.cpp b/tests/database.cpp
index 20a446b..7ab6da8 100644
--- a/tests/database.cpp
+++ b/tests/database.cpp
@@ -16,13 +16,10 @@ TEST_CASE("Database")
std::string postgresql_uri{"postgresql://"};
const char* env_value = ::getenv("TEST_POSTGRES_URI");
if (env_value != nullptr)
- postgresql_uri += env_value;
+ Database::open("postgresql://"s + env_value);
else
- postgresql_uri += "/test";
- Database::open(postgresql_uri);
-#else
- Database::open(":memory:");
#endif
+ Database::open(":memory:");
Database::raw_exec("DELETE FROM " + Database::irc_server_options.get_name());
Database::raw_exec("DELETE FROM " + Database::irc_channel_options.get_name());
@@ -121,5 +118,5 @@ TEST_CASE("Database")
}
Database::close();
-#endif
}
+#endif