mirror of
https://github.com/openappsec/openappsec.git
synced 2025-09-29 11:16:30 +03:00
Jan_31_2024-Dev
This commit is contained in:
@@ -198,13 +198,11 @@ MainloopComponent::Impl::reportStartupEvent()
|
||||
|
||||
LogRest startup_message_client_rest(startup_message);
|
||||
|
||||
Singleton::Consume<I_Messaging>::by<MainloopComponent>()->sendObjectWithPersistence(
|
||||
startup_message_client_rest,
|
||||
I_Messaging::Method::POST,
|
||||
Singleton::Consume<I_Messaging>::by<MainloopComponent>()->sendAsyncMessage(
|
||||
HTTPMethod::POST,
|
||||
fog_event_uri,
|
||||
"",
|
||||
true,
|
||||
MessageTypeTag::REPORT
|
||||
startup_message_client_rest,
|
||||
MessageCategory::LOG
|
||||
);
|
||||
|
||||
dbgInfo(D_MAINLOOP) << "Startup report was successfully sent to fog";
|
||||
|
@@ -6,6 +6,6 @@ link_directories(${Boost_LIBRARY_DIRS})
|
||||
add_unit_test(
|
||||
mainloop_ut
|
||||
"mainloop_ut.cc"
|
||||
"mainloop;singleton;boost_context;rest;metric;event_is;-lboost_regex"
|
||||
"mainloop;messaging;singleton;boost_context;rest;metric;event_is;-lboost_regex"
|
||||
)
|
||||
|
||||
|
@@ -34,6 +34,9 @@ public:
|
||||
|
||||
Debug::setUnitTestFlag(D_MAINLOOP, Debug::DebugLevel::DEBUG);
|
||||
Debug::setNewDefaultStdout(&capture_debug);
|
||||
|
||||
ON_CALL(mock_agent_details, getFogDomain()).WillByDefault(Return(Maybe<string>(string("fog_domain.com"))));
|
||||
ON_CALL(mock_agent_details, getFogPort()).WillByDefault(Return(Maybe<uint16_t>(443)));
|
||||
}
|
||||
|
||||
~MainloopTest()
|
||||
@@ -48,14 +51,14 @@ public:
|
||||
{
|
||||
EXPECT_CALL(
|
||||
mock_msg,
|
||||
mockSendPersistentMessage(false, _, _, "/api/v1/agents/events", _, _, _)
|
||||
sendAsyncMessage(_, "/api/v1/agents/events", _, _, _)
|
||||
).Times(2).WillRepeatedly(
|
||||
WithArgs<1, 6>(
|
||||
WithArgs<2, 3>(
|
||||
Invoke(
|
||||
[this](const string &req_body, MessageTypeTag tag)
|
||||
[this](const string &req_body, MessageCategory tag)
|
||||
{
|
||||
EXPECT_TRUE(tag == MessageTypeTag::REPORT || tag == MessageTypeTag::METRIC);
|
||||
if (tag == MessageTypeTag::REPORT) startup_report_body = req_body;
|
||||
EXPECT_TRUE(tag == MessageCategory::LOG || tag == MessageCategory::METRIC);
|
||||
if (tag == MessageCategory::LOG) startup_report_body = req_body;
|
||||
static bool should_throw = false;
|
||||
if (should_throw) {
|
||||
should_throw = false;
|
||||
@@ -64,7 +67,7 @@ public:
|
||||
should_throw = true;
|
||||
}
|
||||
|
||||
return string();
|
||||
return;
|
||||
}
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user