Skip to content

Commit

Permalink
chore: More debug logging for R2DBC tests
Browse files Browse the repository at this point in the history
  • Loading branch information
johanandren committed Sep 7, 2023
1 parent ca1a1b3 commit 988d590
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ object R2dbcProjectionSpec {
val savedStrOpt = findById(id)

savedStrOpt.flatMap { strOpt =>
logger.debug("Find by id [{}] found [{}]", id, strOpt)
val newConcatStr = strOpt
.map {
_.concat(payload)
Expand Down Expand Up @@ -148,7 +149,13 @@ object R2dbcProjectionSpec {

R2dbcExecutor
.updateOneInTx(stmt)
.map(_ => Done)
.map { updated =>
if (updated != 1L) {
throw new RuntimeException(
s"Update '$stmtSql' of $concatStr didn't see the expected 1 updated rows (was $updated)")
} else logger.debug(s"Successfully updated [{}] to [{}]", concatStr.id, concatStr.text)
Done
}
}

def findById(id: String): Future[Option[ConcatStr]] = {
Expand Down

0 comments on commit 988d590

Please sign in to comment.