Подготовка интеграционного теста

This commit is contained in:
Антон
2025-10-06 17:57:05 +03:00
parent 89d7f62f28
commit 139cf01557
4 changed files with 49 additions and 2 deletions
+12
View File
@@ -14,11 +14,15 @@
#include <string>
#include <thread>
#include <vector>
#include <boost/log/trivial.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include "./session/WebsocketSession.h"
#include "./listener/Listener.h"
#include "./db/mysql_connector.h"
#include "entities/user.h"
#include "log/Log.h"
namespace beast = boost::beast;
namespace http = beast::http;
@@ -28,6 +32,7 @@ using tcp = boost::asio::ip::tcp;
using namespace uad;
using namespace std;
using namespace std::string_literals;
namespace logging = boost::log;
int main(int argc, char* argv[])
{
@@ -44,6 +49,11 @@ int main(int argc, char* argv[])
auto const threads = std::max<int>(1, std::atoi(argv[4]));
string mysql_credentials = argv[5];
InitLogs();
// Добавление общих атрибутов (включая время)
logging::add_common_attributes();
uad::SetMySqlSession(new mysqlx::Session(mysql_credentials));
net::io_context ioc{threads};
@@ -53,6 +63,8 @@ int main(int argc, char* argv[])
net::signal_set signals(ioc, SIGINT, SIGTERM);
signals.async_wait([&](beast::error_code const&, int) { ioc.stop(); });
BOOST_LOG_TRIVIAL(error) << "Приложение запущено";
std::vector<std::thread> v;
v.reserve(threads - 1);
for (auto i = threads - 1; i > 0; --i)