forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_listener.cc
22 lines (17 loc) · 977 Bytes
/
test_listener.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "test/test_listener.h"
#include "source/common/common/assert.h"
#include "test/test_common/global.h"
namespace Envoy {
void TestListener::OnTestEnd(const ::testing::TestInfo& test_info) {
// Check that all singletons have been destroyed.
std::string active_singletons = Envoy::Test::Globals::describeActiveSingletons();
RELEASE_ASSERT(active_singletons.empty(),
absl::StrCat("FAIL [", test_info.test_suite_name(), ".", test_info.name(),
"]: Active singletons exist. Something is leaking. Consider "
"commenting out this assert and letting the heap checker run:\n",
active_singletons));
RELEASE_ASSERT(!Thread::MainThread::isMainThreadActive(),
absl::StrCat("MainThreadLeak: [", test_info.test_suite_name(), ".",
test_info.name(), "] test exited before main thread shut down"));
}
} // namespace Envoy