Repository navigation
Conversation
|
|
|
Welcome @flrnd! |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brendandburns, flrnd The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
The same failure occurs on Java 11, 17, and 21 in the Windows Bazel build. In this case, I now wonder if it is worth finding a deterministic way to generate the timestamps, or if leaving the sleep in place makes sense. |
|
Another alternative to @@ -144,8 +138,8 @@ class EventCorrelatorTest {
Boolean expectedSkip)
throws Exception {
EventCorrelator correlator = new EventCorrelator();
+ OffsetDateTime now = OffsetDateTime.now();
for (CoreV1Event event : previousEvents) {
- OffsetDateTime now = OffsetDateTime.now();
event.setFirstTimestamp(now);
event.setLastTimestamp(now);
Optional<MutablePair<CoreV1Event, V1Patch>> result = correlator.correlate(event);
@@ -153,7 +147,7 @@ class EventCorrelatorTest {
correlator.updateState(event);
}
}
- OffsetDateTime now = OffsetDateTime.now();
+ now = now.plusNanos(10);
newEvent.setFirstTimestamp(now);
newEvent.setLastTimestamp(now); |
|
Feel free to try that alternate fix and update this PR. |
|
New changes are detected. LGTM label has been removed. |
Avoid relying on Thread.sleep(100) to produce distinct timestamps. The sleep was removed because the test only requires timestamp ordering, not elapsed time. However, the Windows Bazel build showed that OffsetDateTime.now() can return identical timestamps in consecutive calls depending on the environment clock resolution. Advance the timestamp explicitly instead, keeping the test deterministic across different platforms.
bd1ce4a to
9f9dcc7
Compare
Notes
Avoid relying on
Thread.sleep(100)to produce distinct timestamps.The sleep was removed because the test only requires timestamp ordering, not elapsed time. However, the Windows Bazel build showed that
OffsetDateTime.now()can return identical timestamps in consecutive calls depending on the environment clock resolution.Advance the timestamp explicitly instead, keeping the test deterministic across different platforms.