This is an automated email from the ASF dual-hosted git repository.

houston pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 98988415d8d Fix instant resolution issue for ClusterEventProducerTest 
on Windows (#3310)
98988415d8d is described below

commit 98988415d8dd8fd0fd01512b7bce5034b933b6df
Author: Houston Putman <[email protected]>
AuthorDate: Tue Apr 8 10:20:20 2025 -0500

    Fix instant resolution issue for ClusterEventProducerTest on Windows (#3310)
---
 .../solr/cluster/events/ClusterEventProducerTest.java   | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git 
a/solr/core/src/test/org/apache/solr/cluster/events/ClusterEventProducerTest.java
 
b/solr/core/src/test/org/apache/solr/cluster/events/ClusterEventProducerTest.java
index e46266f2f80..adab07457b8 100644
--- 
a/solr/core/src/test/org/apache/solr/cluster/events/ClusterEventProducerTest.java
+++ 
b/solr/core/src/test/org/apache/solr/cluster/events/ClusterEventProducerTest.java
@@ -30,6 +30,7 @@ import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Phaser;
 import java.util.concurrent.TimeUnit;
+import org.apache.commons.exec.OS;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.request.V2Request;
 import org.apache.solr.client.solrj.request.beans.PluginMeta;
@@ -379,7 +380,13 @@ public class ClusterEventProducerTest extends 
SolrCloudTestCase {
         lastEvent.getType());
     // verify timestamp
     Instant now = Instant.now();
-    assertTrue("timestamp of the event is in the future", 
now.isAfter(lastEvent.getTimestamp()));
+    if (OS.isFamilyWindows()) {
+      // JDK-8180466 - Windows does not have fine-grained Instant support, so 
accept equal times
+      assertFalse(
+          "timestamp of the event is in the future", 
now.isBefore(lastEvent.getTimestamp()));
+    } else {
+      assertTrue("timestamp of the event is in the future", 
now.isAfter(lastEvent.getTimestamp()));
+    }
     assertEquals(collection, ((CollectionsAddedEvent) 
lastEvent).getCollectionNames().next());
 
     dummyEventLatch = new CountDownLatch(1);
@@ -398,7 +405,13 @@ public class ClusterEventProducerTest extends 
SolrCloudTestCase {
         lastEvent.getType());
     // verify timestamp
     now = Instant.now();
-    assertTrue("timestamp of the event is in the future", 
now.isAfter(lastEvent.getTimestamp()));
+    if (OS.isFamilyWindows()) {
+      // JDK-8180466 - Windows does not have fine-grained Instant support, so 
accept equal times
+      assertFalse(
+          "timestamp of the event is in the future", 
now.isBefore(lastEvent.getTimestamp()));
+    } else {
+      assertTrue("timestamp of the event is in the future", 
now.isAfter(lastEvent.getTimestamp()));
+    }
     assertEquals(collection, ((CollectionsRemovedEvent) 
lastEvent).getCollectionNames().next());
 
     // test changing the ClusterEventProducer plugin dynamically

Reply via email to