summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlie Swanson <cswanson310@gmail.com>2016-05-16 15:59:18 -0400
committerCharlie Swanson <cswanson310@gmail.com>2016-10-05 12:01:04 -0400
commita90b989b87efa32206401cc6bef0429db59f2b64 (patch)
treee80c107f5d4eeb9d930c5e4ff0c5c70ff2b270e1
parentceac8df2ac2fac51c12ba0c576aa953349da6418 (diff)
downloadmongo-a90b989b87efa32206401cc6bef0429db59f2b64.tar.gz
SERVER-24168 Increase tolerance of random sampling tests.
SampleRandomCursorBasics::MimicNonOptimized has failed a couple times with values that were close to the acceptable cutoffs. This commit increases the acceptable cutoffs. (cherry picked from commit 461ee5376cbe09cb5c0c4b1db118a3d5a5973a7e)
-rw-r--r--src/mongo/db/pipeline/document_source_test.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mongo/db/pipeline/document_source_test.cpp b/src/mongo/db/pipeline/document_source_test.cpp
index bdf9ac79a39..71bd9bea499 100644
--- a/src/mongo/db/pipeline/document_source_test.cpp
+++ b/src/mongo/db/pipeline/document_source_test.cpp
@@ -1347,13 +1347,15 @@ TEST_F(SampleFromRandomCursorBasics, MimicNonOptimized) {
ASSERT_TRUE((*doc).hasRandMetaField());
secondTotal += (*doc).getRandMetaField();
}
- // The average random meta value of the first document should be about 0.75.
- ASSERT_GTE(firstTotal / nTrials, 0.74);
- ASSERT_LTE(firstTotal / nTrials, 0.76);
+ // The average random meta value of the first document should be about 0.75. We assume that
+ // 10000 trials is sufficient for us to apply the Central Limit Theorem. Using an error
+ // tolerance of 0.02 gives us a spurious failure rate approximately equal to 10^-24.
+ ASSERT_GTE(firstTotal / nTrials, 0.73);
+ ASSERT_LTE(firstTotal / nTrials, 0.77);
// The average random meta value of the second document should be about 0.5.
- ASSERT_GTE(secondTotal / nTrials, 0.49);
- ASSERT_LTE(secondTotal / nTrials, 0.51);
+ ASSERT_GTE(secondTotal / nTrials, 0.48);
+ ASSERT_LTE(secondTotal / nTrials, 0.52);
}
} // namespace DocumentSourceSampleFromRandomCursor