Skip to content

Commit bd6bad1

Browse files
authored
Fix eventually statements (#1835)
With the move to akka _typed_, we will be using more and more scalatest's `eventually` as a replacement for akka's `awaitCond` (which isn't available in `testkit.typed`). But there is a catch: - `awaitCond` expects a boolean - `eventually` expects a non-failure Which means that we must use `eventually(assert(cond))`, and not `eventually(cond)`.
1 parent 2b6d564 commit bd6bad1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

eclair-core/src/test/scala/fr/acinq/eclair/db/PgUtilsSpec.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class PgUtilsSpec extends TestKitBaseClass with AnyFunSuiteLike with Eventually
4242

4343
// we close the first connection
4444
db.dataSource.close()
45-
eventually(db.dataSource.isClosed)
45+
eventually(assert(db.dataSource.isClosed))
4646
// we wait just a bit longer than the lease interval
4747
Thread.sleep(6_000)
4848

@@ -52,7 +52,7 @@ class PgUtilsSpec extends TestKitBaseClass with AnyFunSuiteLike with Eventually
5252

5353
// we close the second connection
5454
db.dataSource.close()
55-
eventually(db.dataSource.isClosed)
55+
eventually(assert(db.dataSource.isClosed))
5656

5757
// but we don't wait for the previous lease to expire, so we can't take over right now
5858
assert(intercept[LockFailureHandler.LockException] {
@@ -73,7 +73,7 @@ class PgUtilsSpec extends TestKitBaseClass with AnyFunSuiteLike with Eventually
7373

7474
// we close the first connection
7575
db.dataSource.close()
76-
eventually(db.dataSource.isClosed)
76+
eventually(assert(db.dataSource.isClosed))
7777

7878
// here we change the config to simulate an involuntary change in the server we connect to
7979
val config1 = ConfigFactory.parseString("postgres.port=1234").withFallback(config)

0 commit comments

Comments
 (0)