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

ivandasch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new ec7d4ed65df IGNITE-18303 Calcite: Fix nanoseconds flakiness in 
LocalDateTimeSupportTest. Speed up this test. (#10413)
ec7d4ed65df is described below

commit ec7d4ed65df78e06ef8e9bcc90914d96124e88e0
Author: Ivan Daschinskiy <[email protected]>
AuthorDate: Thu Dec 1 15:14:53 2022 +0300

    IGNITE-18303 Calcite: Fix nanoseconds flakiness in 
LocalDateTimeSupportTest. Speed up this test. (#10413)
---
 .../integration/LocalDateTimeSupportTest.java      | 30 ++++++++++++----------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git 
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LocalDateTimeSupportTest.java
 
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LocalDateTimeSupportTest.java
index 2b10ea90388..6bda9cf2075 100644
--- 
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LocalDateTimeSupportTest.java
+++ 
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LocalDateTimeSupportTest.java
@@ -23,15 +23,19 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.Month;
+import java.time.temporal.ChronoUnit;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Date;
 import java.util.List;
 import java.util.function.Function;
+import org.apache.ignite.Ignite;
 import org.apache.ignite.cache.QueryEntity;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import 
org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
 import org.apache.ignite.internal.util.typedef.G;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -185,18 +189,14 @@ public class LocalDateTimeSupportTest extends 
AbstractBasicIntegrationTest {
     }
 
     /** {@inheritDoc} */
-    @Override public void beforeTest() throws Exception {
-        if (!G.allGrids().isEmpty())
-            return;
-
-        startGrids(nodeCount());
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
 
-        client = startClientGrid("client");
-    }
+        for (Ignite ig: G.allGrids()) {
+            IgniteCacheObjectProcessor objProc = 
((IgniteEx)ig).context().cacheObjects();
 
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        stopAllGrids();
+            objProc.removeType(objProc.typeId(Data.class.getName()));
+        }
     }
 
     /** */
@@ -249,9 +249,9 @@ public class LocalDateTimeSupportTest extends 
AbstractBasicIntegrationTest {
         LocalDateTime oldDateTime = LocalDateTime.of(1042, Month.APRIL, 1, 12, 
45, 0);
         LocalDate oldDate = LocalDate.of(1042, Month.APRIL, 1);
         if (cls == LocalDateTime.class)
-            return isOldDate ? oldDateTime : LocalDateTime.now();
+            return isOldDate ? oldDateTime : 
LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);
         else if (cls == LocalTime.class)
-            return LocalTime.now();
+            return LocalTime.now().truncatedTo(ChronoUnit.MILLIS);
         else if (cls == LocalDate.class)
             return isOldDate ? oldDate : LocalDate.now();
         else if (cls == Date.class)
@@ -260,8 +260,10 @@ public class LocalDateTimeSupportTest extends 
AbstractBasicIntegrationTest {
             return isOldDate ? java.sql.Date.valueOf(oldDate) : 
java.sql.Date.valueOf(LocalDate.now());
         else if (cls == java.sql.Time.class)
             return java.sql.Time.valueOf(LocalTime.now());
-        else if (cls == java.sql.Timestamp.class)
-            return isOldDate ? convertToTimestamp(oldDateTime) : 
java.sql.Timestamp.valueOf(LocalDateTime.now());
+        else if (cls == java.sql.Timestamp.class) {
+            return isOldDate ? convertToTimestamp(oldDateTime)
+                : 
java.sql.Timestamp.valueOf(LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS));
+        }
         else
             throw new IllegalStateException();
     }

Reply via email to