From c54354422302a8b8907155d88b812c812223c625 Mon Sep 17 00:00:00 2001 From: Joshua Marantz Date: Mon, 4 Feb 2019 16:43:58 -0500 Subject: [PATCH] Add a note explaining in more detail the current and potential benefits of a common TestBase class. Signed-off-by: Joshua Marantz --- test/test_common/test_base.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/test_common/test_base.h b/test/test_common/test_base.h index c4044fe6b745d..fc0396fcc2c90 100644 --- a/test/test_common/test_base.h +++ b/test/test_common/test_base.h @@ -5,14 +5,27 @@ namespace Envoy { // Provides a common test-base class for all tests in Envoy to use. This offers -// a place to put hooks we'd like to run on every tests. +// a place to put hooks we'd like to run on every test. There's currently a +// check that all test-scoped singletons have been destroyed. A test-scoped +// singleton might remain at the end of a test if it's transitively referenced +// by a leaked structure or a static. +// +// In the future, we can also add: +// - a test-specific ThreadFactory that enables us to verify there are no +// outstanding threads at the end of each thread. +// - a check that no more bytes of memory are allocated at the end of a test +// than there were at the start of it. This is likely to fail in a few +// places when introduced, but we could add known test overrides for this. +// +// Note: nothing compute-intensive should be put in this test-class, as it will +// be a tax paid by every test method in the codebase. class TestBase : public ::testing::Test { public: static bool checkSingletonQuiescensce(); ~TestBase() override; }; -// Templatized version of TestBase. +// Templatized version of TestBase. See above notes. template class TestBaseWithParam : public ::testing::TestWithParam { public: ~TestBaseWithParam() { TestBase::checkSingletonQuiescensce(); }