Skip to content

Commit

Permalink
Account for unit test rare failure seen IRL in 2.x branch
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Dec 1, 2024
1 parent e71ccf5 commit fdc87a3
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ public void testBorrowObjectOverrideMaxWaitLarge() throws Exception {
"borrowObject must fail quickly due to timeout parameter"));
final long millis = d.toMillis();
final long nanos = d.toNanos();
assertTrue(nanos > 0, () -> "borrowObject(Duration) argument not respected: " + nanos);
assertTrue(nanos >= 0, () -> "borrowObject(Duration) argument not respected: " + nanos);
assertTrue(millis >= 0, () -> "borrowObject(Duration) argument not respected: " + millis); // not > 0 to account for spurious waits
assertTrue(millis < 50, () -> "borrowObject(Duration) argument not respected: " + millis);
}
Expand All @@ -1111,7 +1111,7 @@ public void testBorrowObjectOverrideMaxWaitSmall() throws Exception {
"borrowObject must fail slowly due to timeout parameter"));
final long millis = d.toMillis();
final long nanos = d.toNanos();
assertTrue(nanos > 0, () -> "borrowObject(Duration) argument not respected: " + nanos);
assertTrue(nanos >= 0, () -> "borrowObject(Duration) argument not respected: " + nanos);
assertTrue(millis >= 0, () -> "borrowObject(Duration) argument not respected: " + millis); // not > 0 to account for spurious waits
assertTrue(millis < 600, () -> "borrowObject(Duration) argument not respected: " + millis);
assertTrue(millis > 490, () -> "borrowObject(Duration) argument not respected: " + millis);
Expand Down

0 comments on commit fdc87a3

Please sign in to comment.