You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by nv...@apache.org on 2023/08/22 06:56:53 UTC

[incubator-pekko-persistence-cassandra] 01/01: Fix flacky tests

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

nvollmar pushed a commit to branch fix-tests
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-persistence-cassandra.git

commit df4e5cb88d16abe8aa49e480463afe1b0de4908d
Author: Nicolas Vollmar <nv...@scaling.ch>
AuthorDate: Tue Aug 22 08:28:05 2023 +0200

    Fix flacky tests
---
 .../cassandra/query/EventsByTagSpec.scala          | 25 +++++++++++-----------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/core/src/test/scala/org/apache/pekko/persistence/cassandra/query/EventsByTagSpec.scala b/core/src/test/scala/org/apache/pekko/persistence/cassandra/query/EventsByTagSpec.scala
index a8ee9c6..6b3fb13 100644
--- a/core/src/test/scala/org/apache/pekko/persistence/cassandra/query/EventsByTagSpec.scala
+++ b/core/src/test/scala/org/apache/pekko/persistence/cassandra/query/EventsByTagSpec.scala
@@ -14,19 +14,18 @@
 package org.apache.pekko.persistence.cassandra.query
 
 import java.time.temporal.ChronoUnit
-import java.time.{ LocalDateTime, ZoneOffset }
+import java.time.{LocalDate, LocalDateTime, ZoneOffset}
 import java.util.Optional
 import java.util.UUID
-
 import org.apache.pekko
-import pekko.actor.{ PoisonPill, Props }
+import pekko.actor.{PoisonPill, Props}
 import pekko.event.Logging.Warning
 import pekko.persistence.cassandra.journal.CassandraJournalStatements
-import pekko.persistence.cassandra.{ CassandraLifecycle, CassandraSpec, Day }
-import pekko.persistence.journal.{ Tagged, WriteEventAdapter }
-import pekko.persistence.query.scaladsl.{ CurrentEventsByTagQuery, EventsByTagQuery }
-import pekko.persistence.query.{ EventEnvelope, NoOffset, Offset, TimeBasedUUID }
-import pekko.persistence.{ PersistentActor, PersistentRepr }
+import pekko.persistence.cassandra.{CassandraLifecycle, CassandraSpec, Day}
+import pekko.persistence.journal.{Tagged, WriteEventAdapter}
+import pekko.persistence.query.scaladsl.{CurrentEventsByTagQuery, EventsByTagQuery}
+import pekko.persistence.query.{EventEnvelope, NoOffset, Offset, TimeBasedUUID}
+import pekko.persistence.{PersistentActor, PersistentRepr}
 import pekko.serialization.SerializationExtension
 import pekko.stream.testkit.TestSubscriber
 import pekko.stream.testkit.scaladsl.TestSink
@@ -35,10 +34,10 @@ import pekko.event.Logging
 import pekko.testkit.TestProbe
 import com.datastax.oss.driver.api.core.CqlIdentifier
 import com.datastax.oss.driver.api.core.uuid.Uuids
-import com.typesafe.config.{ Config, ConfigFactory }
+import com.typesafe.config.{Config, ConfigFactory}
 import org.scalatest.BeforeAndAfterEach
-import scala.concurrent.duration._
 
+import scala.concurrent.duration._
 import pekko.persistence.cassandra.PluginSettings
 
 object EventsByTagSpec {
@@ -50,7 +49,7 @@ object EventsByTagSpec {
     }
   }
 
-  val today = LocalDateTime.now(ZoneOffset.UTC)
+  val today = LocalDate.now(ZoneOffset.UTC).atStartOfDay()
 
   val config = ConfigFactory.parseString(s"""
     pekko.actor.serialize-messages = off
@@ -1122,7 +1121,7 @@ class EventsByTagSpecBackTrackingLongRefreshInterval
       probe.expectNextPF { case e @ EventEnvelope(_, "p2", 1L, "e1") => e }
       // now a delayed events for p1 in the previous bucket, should be found by the short back track
       writeTaggedEvent(
-        today.minusDays(1).minusHours(1),
+        today.minusHours(1),
         PersistentRepr("e1", 1L, "p1", ""),
         Set(tagName),
         1,
@@ -1203,7 +1202,7 @@ class EventsByTagSpecBackTracking
 
       // now a delayed events for p1 in the previous bucket, further back than the short period
       writeTaggedEvent(
-        today.minusDays(1).minusHours(1),
+        today.minusHours(1),
         PersistentRepr("e3", 3L, "p1", ""),
         Set(tagName),
         3,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org