Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix singleton in StatisticsBackendData [15841] #172

Merged
merged 13 commits into from
Oct 24, 2022
Prev Previous commit
Next Next commit
Refs #15841: Fix tests that set monitors ad-hoc and then they fail in…
… destruction

Signed-off-by: jparisu <javierparis@eprosima.com>
  • Loading branch information
jparisu committed Oct 18, 2022
commit dc1cfa318851f72282834843d429c85a14a88fc3
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