Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
barryoneill committed May 15, 2024
1 parent f9d38f7 commit c9238ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
package io.laserdisc.mysql.binlog.models

import cats.effect.IO
import com.dimafeng.testcontainers.{Container, ForAllTestContainer}
import cats.effect.unsafe.implicits.global
import com.dimafeng.testcontainers.ForAllTestContainer
import db.MySqlContainerTest
import doobie.util.transactor.Transactor
import doobie.util.transactor.Transactor.Aux
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
import cats.effect.unsafe.implicits.global

class SchemaMetadataTest extends AnyWordSpec with ForAllTestContainer with MySqlContainerTest with Matchers {

"Schema Metadata" should {

"restore schema state from DB" in {

val props = new java.util.Properties()
props.put("user", container.username)
props.put("password", container.username)

implicit val testTransactor: Aux[IO, Unit] =
Transactor.fromDriverManager[IO](
mySQLContainer.driverClassName,
s"${mySQLContainer.jdbcUrl}?useSSL=false",
props,
mysqlDBCreds,
None
)
val schemaState =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ trait MySqlContainerTest extends TestContainersForAll with BeforeAndAfterEach {
this.container.withInitScript("init.sql")

}
protected lazy val mysqlDBCreds = {
val props = new java.util.Properties()
props.put("user", container.username)
props.put("password", container.password)
props
}

implicit val ec: ExecutionContext = Implicits.global

Expand All @@ -52,11 +58,11 @@ trait MySqlContainerTest extends TestContainersForAll with BeforeAndAfterEach {
val uri = URI.create(cleanURI)

BinLogConfig(
uri.getHost,
uri.getPort,
mySQLContainer.username,
mySQLContainer.password,
mySQLContainer.databaseName,
host = uri.getHost,
port = uri.getPort,
user = mySQLContainer.username,
password = mySQLContainer.password,
schema = mySQLContainer.databaseName,
useSSL = false,
poolSize = 3,
serverId = Some(1234)
Expand Down

0 comments on commit c9238ea

Please sign in to comment.