Skip to content

Commit

Permalink
Refs #15841: Fix tests that set monitors ad-hoc and then they fail in…
Browse files Browse the repository at this point in the history
… destruction

Signed-off-by: jparisu <javierparis@eprosima.com>
  • Loading branch information
jparisu committed Oct 7, 2022
1 parent bb84d67 commit b1744c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/unittest/Database/DatabaseStatusTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class database_status_tests : public ::testing::Test
// Simulate that the backend is monitorizing the domain
// NOTE: This is so F*** dangerous, please do not do it again (1)
std::shared_ptr<details::Monitor> monitor = std::make_shared<details::Monitor>();
monitor->id = domain->id;
details::StatisticsBackendData::get_instance()->monitors_by_entity_[domain->id] = monitor;

// Simulate the discover of the entitiy
Expand Down Expand Up @@ -81,11 +82,11 @@ class database_status_tests : public ::testing::Test
}


void TearDown()
{
// NOTE: This is thanks to (1) brilliant idea
details::StatisticsBackendData::get_instance()->monitors_by_entity_.erase(domain->id);
}
// void TearDown()
// {
// // NOTE: This is thanks to (1) brilliant idea
// details::StatisticsBackendData::get_instance()->monitors_by_entity_.erase(domain->id);
// }

std::shared_ptr<Host> host;
std::shared_ptr<User> user;
Expand Down
1 change: 1 addition & 0 deletions test/unittest/StatisticsBackend/IsActiveTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class is_active_tests : public ::testing::Test

// Simulate that the backend is monitorizing the domain
std::shared_ptr<details::Monitor> monitor = std::make_shared<details::Monitor>();
monitor->id = domain->id;
details::StatisticsBackendData::get_instance()->monitors_by_entity_[domain->id] = monitor;

// Simulate the discover of the entitiy
Expand Down

0 comments on commit b1744c5

Please sign in to comment.