SERVER-120972 Remove flaky test case of ticket_semaphore unittests (#49075)

GitOrigin-RevId: 862dcf8aa8042b0f8efd066d4a90378852c8d5a4
This commit is contained in:
Marcos Grillo
2026-03-05 16:37:25 +01:00
committed by MongoDB Bot
parent 7cb72dd8f4
commit b3b8da53ce

View File

@@ -668,43 +668,6 @@ TEST_P(TicketSemaphoreTest, ConcurrentAcquireDoesNotOverbookOrLeak) {
ASSERT_EQ(concurrentHolders.load(), 0);
}
/**
* Tests that when a permit is forwarded to a waiter who then times out, the permit is properly
* returned to the pool.
*/
TEST_P(TicketSemaphoreTest, PermitForwardingViaTimeout) {
auto sem = makeSemaphore(1);
auto* rawSem = sem.get();
ASSERT_TRUE(sem->tryAcquire());
ASSERT_EQ(sem->available(), 0);
auto deltaTime = Milliseconds{100};
auto shortDeadline = Date_t::now() + deltaTime;
Future<bool> timeoutWaiter = spawn([&, rawSem, shortDeadline, svcCtx = getServiceContext()]() {
auto client = svcCtx->getService()->makeClient("timeoutWaiter");
auto waiterOpCtx = client->makeOperationContext();
MockAdmissionContext admCtx;
return rawSem->acquire(waiterOpCtx.get(), &admCtx, shortDeadline, true);
});
waitUntilBlocked(rawSem, 1);
sleepFor(deltaTime);
// Release the permit - it will be forwarded to the waiting thread.
// But the waiter should timeout and the permit should be reclaimed.
rawSem->release();
bool result = true;
_opCtx->runWithDeadline(getDeadline(), ErrorCodes::ExceededTimeLimit, [&] {
result = std::move(timeoutWaiter).get(_opCtx.get());
});
ASSERT_FALSE(result);
ASSERT_EQ(rawSem->waiters(), 0);
ASSERT_EQ(rawSem->available(), 1);
}
/**
* Tests complex permit forwarding: wake up three waiters, first two time out or get interrupted,
* third succeeds. Verify final permit count.