summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@mongodb.com>2020-01-24 20:21:16 +0000
committerevergreen <evergreen@mongodb.com>2020-01-24 20:21:16 +0000
commitfe718c5644621df759085ee2bd55ec96252816cb (patch)
tree2a3fc5ba7bc1e83b617b5da1c6b343528f8f0d1d
parentda10609010f8b13307206b21e45b729c6d10d40d (diff)
downloadmongo-fe718c5644621df759085ee2bd55ec96252816cb.tar.gz
SERVER-45758 Add sleep to TimeInactiveMicrosShouldBeSetUponUnstashAndStash in session_test
-rw-r--r--src/mongo/db/session_test.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/session_test.cpp b/src/mongo/db/session_test.cpp
index 2e918a68bc1..5e8424db7c3 100644
--- a/src/mongo/db/session_test.cpp
+++ b/src/mongo/db/session_test.cpp
@@ -1688,6 +1688,9 @@ TEST_F(TransactionsMetricsTest, SingleTransactionStatsDurationShouldKeepIncreasi
txnDurationAfterStart);
sleepmillis(10);
session.commitTransaction(opCtx());
+ // Sleep here to allow enough time to elapse.
+ sleepmillis(10);
+
unsigned long long txnDurationAfterCommit =
session.getSingleTransactionStats()->getDuration(curTimeMicros64());
@@ -1722,6 +1725,9 @@ TEST_F(TransactionsMetricsTest, SingleTransactionStatsDurationShouldKeepIncreasi
txnDurationAfterStart);
sleepmillis(10);
session.abortArbitraryTransaction();
+ // Sleep here to allow enough time to elapse.
+ sleepmillis(10);
+
unsigned long long txnDurationAfterAbort =
session.getSingleTransactionStats()->getDuration(curTimeMicros64());
@@ -2123,6 +2129,8 @@ TEST_F(TransactionsMetricsTest, TimeInactiveMicrosShouldBeSetUponUnstashAndStash
// The transaction machinery cannot store an empty locker.
{ Lock::GlobalLock lk(opCtx(), MODE_IX, Date_t::now(), Lock::InterruptBehavior::kThrow); }
session.stashTransactionResources(opCtx());
+ // Sleep here to allow enough time to elapse.
+ sleepmillis(10);
// The transaction is inactive again, so time inactive should have increased.
ASSERT_GT(session.getSingleTransactionStats()->getTimeInactiveMicros(curTimeMicros64()),