Skip to content

Commit 0ceda9f

Browse files
authored
tests: Fix order of used memory counter reset (#6012)
used memory counter was previously reset after starting service. This opened up the possibility that a few cycles of engine shard memory account ran, which incremented used memory, and then this value was reset. This resulted in lost bytes and tests which rely on this value, for example to measure eviction, would fail. Here the order is moved so that used memory is reset first and then service is started. Signed-off-by: Abhijat Malviya <[email protected]>
1 parent 3ee7c18 commit 0ceda9f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/server/dragonfly_test.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,6 @@ TEST_F(DflyEngineTest, StickyEviction) {
564564
#endif
565565

566566
TEST_F(DflyEngineTest, ZeroAllocationEviction) {
567-
GTEST_SKIP() << "Currently being fixed, unblock CI";
568567
max_memory_limit = 500000; // 0.5mb
569568
shard_set->TEST_EnableCacheMode();
570569

src/server/test_utils.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,11 @@ void BaseFamilyTest::ResetService() {
249249
pp_->Run();
250250
service_ = std::make_unique<Service>(pp_.get());
251251

252-
service_->Init(nullptr, {});
252+
// Must be reset before starting the service. Engine shard heartbeat task updates this
253+
// value, and if reset after some invocations of heartbeat have run, the accumulated data is
254+
// lost and can cause test failure.
253255
used_mem_current = 0;
256+
service_->Init(nullptr, {});
254257

255258
TEST_current_time_ms = absl::GetCurrentTimeNanos() / 1000000;
256259
auto default_ns = &namespaces->GetDefaultNamespace();

0 commit comments

Comments
 (0)