Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
guizmaii committed Dec 4, 2024
1 parent 06c29fd commit b496cd9
Showing 1 changed file with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,19 @@ def immutableRepoZioTests(
)

test("count"):
runIO:
magzio.connect(xa()):
assert(carRepo.count == 3L)
val count =
runIO:
magzio.connect(xa()):
carRepo.count
assert(count == 3L)

test("existsById"):
runIO:
magzio.connect(xa()):
assert(carRepo.existsById(3L))
assert(!carRepo.existsById(4L))
val (exists3, exists4) =
runIO:
magzio.connect(xa()):
carRepo.existsById(3L) -> carRepo.existsById(4L)
assert(exists3)
assert(!exists4)

test("findAll"):
val cars =
Expand All @@ -85,10 +89,12 @@ def immutableRepoZioTests(
assert(cars == allCars)

test("findById"):
runIO:
magzio.connect(xa()):
assert(carRepo.findById(3L).get == allCars.last)
assert(carRepo.findById(4L) == None)
val (exists3, exists4) =
runIO:
magzio.connect(xa()):
carRepo.findById(3L) -> carRepo.findById(4L)
assert(exists3.get == allCars.last)
assert(exists4 == None)

test("findAllByIds"):
assume(dbType != ClickhouseDbType)
Expand All @@ -102,9 +108,11 @@ def immutableRepoZioTests(
assert(ids == Vector(1L, 3L))

test("serializable transaction"):
runIO:
magzio.transact(xa().copy(connectionConfig = withSerializable)):
assert(carRepo.count == 3L)
val count =
runIO:
magzio.transact(xa().copy(connectionConfig = withSerializable)):
carRepo.count
assert(count == 3L)

def withSerializable(con: Connection): Unit =
con.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE)
Expand Down

0 comments on commit b496cd9

Please sign in to comment.