chore: Repeat-based tests TSAN fixes (#2810)

This commit is contained in:
Alex Kremer
2025-11-25 12:15:43 +00:00
committed by GitHub
parent 1b1a46c429
commit 4eadaa85fa
3 changed files with 28 additions and 11 deletions

View File

@@ -53,16 +53,16 @@ struct RepeatTests : SyncAsioContextTest {
TEST_F(RepeatTests, CallsHandler)
{
repeat.start(std::chrono::milliseconds{1}, handlerMock.AsStdFunction());
EXPECT_CALL(handlerMock, Call).Times(testing::AtMost(22));
repeat.start(std::chrono::milliseconds{1}, handlerMock.AsStdFunction());
runContextFor(std::chrono::milliseconds{20});
}
TEST_F(RepeatTests, StopsOnStop)
{
withRunningContext([this]() {
repeat.start(std::chrono::milliseconds{1}, handlerMock.AsStdFunction());
EXPECT_CALL(handlerMock, Call).Times(AtLeast(1));
repeat.start(std::chrono::milliseconds{1}, handlerMock.AsStdFunction());
std::this_thread::sleep_for(std::chrono::milliseconds{10});
repeat.stop();
});
@@ -72,8 +72,8 @@ TEST_F(RepeatTests, RunsAfterStop)
{
withRunningContext([this]() {
for ([[maybe_unused]] auto i : std::ranges::iota_view(0, 2)) {
repeat.start(std::chrono::milliseconds{1}, handlerMock.AsStdFunction());
EXPECT_CALL(handlerMock, Call).Times(AtLeast(1));
repeat.start(std::chrono::milliseconds{1}, handlerMock.AsStdFunction());
std::this_thread::sleep_for(std::chrono::milliseconds{10});
repeat.stop();
}