Skip to content

Commit

Permalink
fix: agent_info reset to default values
Browse files Browse the repository at this point in the history
Due to recent changes in the agent's info implementation,
where the sql logic was replaced with the SQLiteManager,
a bug was introduced in the ResetToDefaults method by which
the AgentInfo tables were not being cleaned up.
  • Loading branch information
jr0me committed Nov 13, 2024
1 parent 69ab7f8 commit 4485ce8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/agent/agent_info/src/agent_info_persistance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,10 @@ void AgentInfoPersistance::ResetToDefault()
{
try
{
m_db->Remove(AGENT_INFO_TABLE_NAME);
m_db->Remove(AGENT_GROUP_TABLE_NAME);
m_db->DropTable(AGENT_INFO_TABLE_NAME);
m_db->DropTable(AGENT_GROUP_TABLE_NAME);
CreateAgentInfoTable();
CreateAgentGroupTable();
InsertDefaultAgentInfo();
}
catch (const std::exception& e)
Expand Down
2 changes: 1 addition & 1 deletion src/agent/tests/agent_registration_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ TEST_F(RegisterTest, RegistrationTestSuccess)
EXPECT_CALL(mockHttpClient, AuthenticateWithUserPassword(testing::_, testing::_, testing::_, testing::_))
.WillOnce(testing::Return("token"));

nlohmann::json bodyJson = agent->GetMetadataInfo(true);
const auto bodyJson = agent->GetMetadataInfo(true);

http_client::HttpRequestParams reqParams(boost::beast::http::verb::post,
"https://localhost:55000",
Expand Down

0 comments on commit 4485ce8

Please sign in to comment.