Skip to content

Commit b4e4055

Browse files
fix: Address AmendmentBlockHandler flakiness in old ETL tests (#2694)
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
1 parent b361e3a commit b4e4055

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tests/unit/etl/AmendmentBlockHandlerTests.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ struct AmendmentBlockHandlerTest : util::prometheus::WithPrometheus, SyncAsioCon
3636
etl::SystemState state;
3737
};
3838

39+
// Note: This test can be flaky due to the way it was written (depends on time)
40+
// Since the old ETL is going to be replaced by ETLng all tests including this one will be deleted anyway so the fix for
41+
// flakiness is to increase the context runtime to 50ms until then (to not waste time).
3942
TEST_F(AmendmentBlockHandlerTest, CallToNotifyAmendmentBlockedSetsStateAndRepeatedlyCallsAction)
4043
{
4144
AmendmentBlockHandler handler{ctx_, state, std::chrono::nanoseconds{1}, actionMock.AsStdFunction()};
@@ -45,12 +48,7 @@ TEST_F(AmendmentBlockHandlerTest, CallToNotifyAmendmentBlockedSetsStateAndRepeat
4548
handler.notifyAmendmentBlocked();
4649
EXPECT_TRUE(state.isAmendmentBlocked);
4750

48-
// Code runs significantly slower when assertions are enabled
49-
#ifdef _GLIBCXX_ASSERTIONS
50-
runContextFor(std::chrono::milliseconds{10});
51-
#else
52-
runContextFor(std::chrono::milliseconds{1});
53-
#endif
51+
runContextFor(std::chrono::milliseconds{50});
5452
}
5553

5654
struct DefaultAmendmentBlockActionTest : LoggerFixture {};

0 commit comments

Comments
 (0)