summaryrefslogtreecommitdiff
path: root/src/mongo/db/logical_clock_test.cpp
diff options
context:
space:
mode:
authorJack Mulrow <jack.mulrow@mongodb.com>2017-03-28 10:32:30 -0400
committerJack Mulrow <jack.mulrow@mongodb.com>2017-03-30 14:15:39 -0400
commit325486685538d00adbd61f868c239b3ecc6938c6 (patch)
treea6f0e7679ebba871e5644ee3c2703ef05f974b9d /src/mongo/db/logical_clock_test.cpp
parentba1fa56004826b42bd8fa7d5b5a0c78fc1b57af9 (diff)
downloadmongo-325486685538d00adbd61f868c239b3ecc6938c6.tar.gz
SERVER-28432 Move key management out from TimeProofService
Diffstat (limited to 'src/mongo/db/logical_clock_test.cpp')
-rw-r--r--src/mongo/db/logical_clock_test.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/mongo/db/logical_clock_test.cpp b/src/mongo/db/logical_clock_test.cpp
index 156232fc386..98c600a1421 100644
--- a/src/mongo/db/logical_clock_test.cpp
+++ b/src/mongo/db/logical_clock_test.cpp
@@ -46,9 +46,7 @@ class LogicalClockTestBase : public unittest::Test {
protected:
void setUp() {
_serviceContext = stdx::make_unique<ServiceContextNoop>();
- std::array<std::uint8_t, 20> tempKey = {};
- TimeProofService::Key key(std::move(tempKey));
- auto pTps = stdx::make_unique<TimeProofService>(std::move(key));
+ auto pTps = stdx::make_unique<TimeProofService>();
_timeProofService = pTps.get();
_clock = stdx::make_unique<LogicalClock>(_serviceContext.get(), std::move(pTps));
}
@@ -63,7 +61,8 @@ protected:
}
SignedLogicalTime makeSignedLogicalTime(LogicalTime logicalTime) {
- return SignedLogicalTime(logicalTime, _timeProofService->getProof(logicalTime), 0);
+ TimeProofService::Key key = {};
+ return SignedLogicalTime(logicalTime, _timeProofService->getProof(logicalTime, key), 0);
}
const unsigned currentWallClockSecs() {
@@ -79,17 +78,11 @@ private:
// Check that the initial time does not change during logicalClock creation.
TEST_F(LogicalClockTestBase, roundtrip) {
- // Create different logicalClock instance to validate that the initial time is preserved.
- ServiceContextNoop serviceContext;
Timestamp tX(1);
- std::array<std::uint8_t, 20> tempKey = {};
- TimeProofService::Key key(std::move(tempKey));
- auto pTps = stdx::make_unique<TimeProofService>(std::move(key));
auto time = LogicalTime(tX);
- LogicalClock logicalClock(&serviceContext, std::move(pTps));
- logicalClock.initClusterTimeFromTrustedSource(time);
- auto storedTime(logicalClock.getClusterTime());
+ getClock()->initClusterTimeFromTrustedSource(time);
+ auto storedTime(getClock()->getClusterTime());
ASSERT_TRUE(storedTime.getTime() == time);
}