Closed Rofl113 closed 1 year ago
I wrote the following code but it didn't help:
std::promise<void> p1;
std::future<void> f1 = p1.get_future();
std::thread thr([&p1]()
{
app().getLoop()->queueInLoop([&p1] ()
{
p1.set_value();
});
app().run();
});
f1.get();
testing::InitGoogleTest(&argc, argv);
int testStatus = RUN_ALL_TESTS();
app().getLoop()->queueInLoop([] ()
{
app().quit();
});
thr.join();
return testStatus;
Crashes on creating Sqlite3Client
:
auto clientDb = drogon::orm::DbClient::newSqlite3Client
The problem turned out to be that the testing::Test
object is created every time and it was necessary to make the database client static with the creation on the first test. Sorry to distract you for nothing.
For ORM Drogon to work, you need to launch the app.
To run Google Test, you also need to run your own loop.
Is it possible to do this?