Only run the unit tests with postgresql if TEST_POSTGRES_URI env var is set

Even if we built with postgresql’s support
This commit is contained in:
louiz’
2017-12-12 23:37:08 +01:00
parent c3313d0d41
commit 53fc926dc8
2 changed files with 3 additions and 17 deletions
+3 -6
View File
@@ -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