Skip to content

Commit 08932a2

Browse files
Migrate Test Suite 824.scala to Munit with Cats Effect (#2218)
* converted to munits cat effect * Update modules/hikari/src/test/scala/doobie/hikari/issue/824.scala Co-authored-by: Sergey Torgashov <satorg@users.noreply.github.com> * Apply Scalafmt formatting * Fixed formatting and resolved line ending issue * Removed sbt-launch.jar from Git tracking * Removed sbt-launch.jar and .bsp/sbt.json from the repository * Reverted irrelevant changes and fixed comment * Migrate Test Suite to Munit with Cats Effect (without sbt files) * Update .gitignore --------- Co-authored-by: Sergey Torgashov <satorg@users.noreply.github.com>
1 parent a07376a commit 08932a2

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ metals.sbt
4646
.vscode/
4747

4848
# sbt
49-
.bsp/
49+
.bsp/

modules/hikari/src/test/scala/doobie/hikari/issue/824.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ import com.zaxxer.hikari.HikariDataSource
1010
import doobie.*
1111
import doobie.hikari.*
1212
import doobie.implicits.*
13+
import doobie.util.ExecutionContexts
1314
import scala.concurrent.duration.*
1415
import scala.util.Random
16+
import munit.CatsEffectSuite
1517

16-
class `824` extends munit.FunSuite {
17-
18-
import cats.effect.unsafe.implicits.global
18+
class `824` extends CatsEffectSuite {
1919

2020
val transactor: Resource[IO, HikariTransactor[IO]] =
2121
for {
22-
ce <- ExecutionContexts.fixedThreadPool[IO](16) // our connect EC
22+
ce <- ExecutionContexts.fixedThreadPool[IO](16) // connect our EC
2323
xa <- HikariTransactor.newHikariTransactor[IO](
2424
"org.h2.Driver", // driver classname
2525
"jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", // connect URL
@@ -60,11 +60,11 @@ class `824` extends munit.FunSuite {
6060
} flatMap { case (n, ds) =>
6161
// One final report to show that all connections are disposed
6262
report(ds) *> IO((n, ds.getHikariPoolMXBean.getTotalConnections))
63-
6463
}
6564

6665
test("HikariTransactor should close connections logically within `use` block and physically afterward.") {
67-
assertEquals(prog.unsafeRunSync(), (0, 0))
66+
prog.assertEquals((0, 0))
67+
6868
}
6969

7070
}

0 commit comments

Comments
 (0)