diff --git a/test/oatpp-postgresql/tests.cpp b/test/oatpp-postgresql/tests.cpp index 0c9daaa..918c200 100644 --- a/test/oatpp-postgresql/tests.cpp +++ b/test/oatpp-postgresql/tests.cpp @@ -6,12 +6,34 @@ #include "types/FloatTest.hpp" #include "types/InterpretationTest.hpp" + +#include "oatpp-postgresql/orm.hpp" #include "oatpp/core/base/Environment.hpp" +#include +#include + namespace { void runTests() { + OATPP_LOGI("Tests", "DB-URL='%s'", TEST_DB_URL); + auto connectionProvider = std::make_shared(TEST_DB_URL); + for(v_int32 i = 0; i < 6; i ++) { + try { + auto connection = connectionProvider->get(); + if(connection) { + OATPP_LOGD("Tests", "Database is up! We've got a connection!"); + break; + } + } catch (...) { + // DO NOTHING + } + + OATPP_LOGD("Tests", "Database is not ready. Sleep 10s..."); + std::this_thread::sleep_for(std::chrono::seconds(10)); + } + OATPP_RUN_TEST(oatpp::test::postgresql::ql_template::ParserTest); OATPP_RUN_TEST(oatpp::test::postgresql::types::IntTest);