summaryrefslogtreecommitdiff
path: root/src/mongo/unittest/unittest.h
diff options
context:
space:
mode:
authorADAM David Alan Martin <adam.martin@10gen.com>2019-01-24 15:53:23 -0500
committerADAM David Alan Martin <adam.martin@10gen.com>2019-01-25 11:55:34 -0500
commit677a65ba43fecf7cf20b7a2c34b5ec2bed413edd (patch)
tree8d9506823c2f003a718b3afc41cdefe7f1cfde71 /src/mongo/unittest/unittest.h
parentbbe09aa5e0966ada5232ffbcb098efdd78b4f24e (diff)
downloadmongo-677a65ba43fecf7cf20b7a2c34b5ec2bed413edd.tar.gz
SERVER-39000 Fix Unittest Framework initialization.
Some tests in `dbtest` do not use the `mongo::unittest::Test` class as a basis for their implementation and thus need some way to benefit from global DB Environment initialization functions. Specifically the changes in SERVER-32630 required `serverCompatibilityVersion` to be set sensibly. Some tests in `dbtest` were not correctly getting this benefit; instead only incidentally getting a correct setting by accident, as the results of an unintended residue of an earlier operation. This can lead to inconsistentcies in which tests pass, as link order changes -- the tests are registered using static initialization, whose instability of order can cause mysterious failures in `dbtest`.
Diffstat (limited to 'src/mongo/unittest/unittest.h')
-rw-r--r--src/mongo/unittest/unittest.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mongo/unittest/unittest.h b/src/mongo/unittest/unittest.h
index 1a6f82a9a36..4614b7a5abd 100644
--- a/src/mongo/unittest/unittest.h
+++ b/src/mongo/unittest/unittest.h
@@ -306,6 +306,16 @@ public:
void run();
+ /**
+ * Called on the test object before running the test.
+ */
+ virtual void setUp() {}
+
+ /**
+ * Called on the test object after running the test.
+ */
+ virtual void tearDown() {}
+
protected:
/**
* Registration agent for adding tests to suites, used by TEST macro.
@@ -363,16 +373,6 @@ protected:
*/
void printCapturedLogLines() const;
- /**
- * Called on the test object before running the test.
- */
- virtual void setUp();
-
- /**
- * Called on the test object after running the test.
- */
- virtual void tearDown();
-
private:
/**
* The test itself.