mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-22 20:55:52 +00:00
fix: Flaky test in ETLng (#2077)
Fixes a flaky test Fix: https://github.com/XRPLF/clio/issues/2075 --------- Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
This commit is contained in:
@@ -89,6 +89,8 @@ createLedgerHeader(std::string_view ledgerHash, ripple::LedgerIndex seq, std::op
|
|||||||
ledgerHeader.seq = seq;
|
ledgerHeader.seq = seq;
|
||||||
|
|
||||||
if (age) {
|
if (age) {
|
||||||
|
// Note: be cautious of using age values close to each other as the underlying NetClock precision is seconds
|
||||||
|
// and the small time difference may lead to comparison bugs
|
||||||
auto const now = duration_cast<seconds>(system_clock::now().time_since_epoch());
|
auto const now = duration_cast<seconds>(system_clock::now().time_since_epoch());
|
||||||
auto const closeTime = (now - seconds{age.value()}).count() - kRIPPLE_EPOCH_START;
|
auto const closeTime = (now - seconds{age.value()}).count() - kRIPPLE_EPOCH_START;
|
||||||
ledgerHeader.closeTime = ripple::NetClock::time_point{seconds{closeTime}};
|
ledgerHeader.closeTime = ripple::NetClock::time_point{seconds{closeTime}};
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ TEST_F(ExtractionModelNgTests, LedgerDataCopyableAndEquatable)
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto third = second;
|
auto third = second;
|
||||||
third.header = createLedgerHeader(kLEDGER_HASH2, kSEQ, 2);
|
third.header = createLedgerHeader(kLEDGER_HASH2, kSEQ, 100); // Using large age value to avoid flaky test
|
||||||
EXPECT_NE(first, third);
|
EXPECT_NE(first, third);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user