Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Scala, sbt and dependencies #46

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ThisBuild / organization := "com.augustnagro"
ThisBuild / version := "1.3.1-SNAPSHOT"
ThisBuild / versionScheme := Some("early-semver")
ThisBuild / scalaVersion := "3.3.0"
ThisBuild / scalaVersion := "3.3.4"
ThisBuild / scalacOptions ++= Seq("-deprecation")
ThisBuild / homepage := Some(url("https://github.com/AugustNagro/magnum"))
ThisBuild / licenses += ("Apache-2.0", url(
Expand Down Expand Up @@ -33,7 +33,9 @@ ThisBuild / publishTo := {
}
ThisBuild / publish / skip := true

val testcontainersVersion = "0.40.12"
Global / onChangedBuildSource := ReloadOnSourceChanges

val testcontainersVersion = "0.41.4"

lazy val root = project
.in(file("."))
Expand All @@ -45,18 +47,18 @@ lazy val magnum = project
Test / fork := true,
publish / skip := false,
libraryDependencies ++= Seq(
"org.scalameta" %% "munit" % "0.7.29" % Test,
"org.scalameta" %% "munit" % "1.0.2" % Test,
"com.dimafeng" %% "testcontainers-scala-munit" % testcontainersVersion % Test,
"com.dimafeng" %% "testcontainers-scala-postgresql" % testcontainersVersion % Test,
"org.postgresql" % "postgresql" % "42.6.0" % Test,
"org.postgresql" % "postgresql" % "42.7.4" % Test,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also update the docker images to the latest LTS release? For example in PgTests:464

  val pgContainer = ForAllContainerFixture(
    PostgreSQLContainer
      .Def(dockerImageName = DockerImageName.parse("postgres:15.2"))
      .createContainer()
  )

We can use the 17.0 image instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 🙂

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, please also update the docker images for the other Dbs as well:

  • ClickHouseTests:393 Version: 24.3.12.75
  • MySqlTests:395 Version: 8.4.2
  • OracleTests:391 Switch to use https://hub.docker.com/r/gvenzl/oracle-free and version 23.5-faststart (or just 23.5 if that one doesn't work)
  • Also, PgCodecTests:157 in magnum-pg module to 17.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AugustNagro Done :)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, getting

java.lang.IllegalStateException: Failed to verify that image 'gvenzl/oracle-free:23.5-faststart' is a compatible substitute for 'gvenzl/oracle-xe'. This generally means that you are trying to use an image that Testcontainers has not been designed to use. If this is deliberate, and if you are confident that the image is compatible, you should declare compatibility in code using the `asCompatibleSubstituteFor` method. For example:
   DockerImageName myImage = DockerImageName.parse("gvenzl/oracle-free:23.5-faststart").asCompatibleSubstituteFor("gvenzl/oracle-xe");

With the new Oracle image.. would you mind reverting to the earlier gvenzl/oracle-xe? It's not up-to-date with the latest release but there's no rush if test-containers doesn't support it yet.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MySQL tests are failing for mysql:8.4.3, with

Could not create/start container

Looking at the docker logs, it exits because of a removed option:

unknown option '--skip-host-cache'

This was reported in testcontainers-java and fixed in 1.20.2

However, testcontainers-scala depends on v 1.19.x .

I've filed an issue to upgrade: testcontainers/testcontainers-scala#368

For now, lets just revert the MySQL image upgrade as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AugustNagro Can we merge #53 maybe, please? That will help me detect these stuff

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed #53 and left a few comments.

Just fyi it's very easy to run the tests locally. You just need to install docker (docker desktop or docker engine), then run sbt test.

"com.dimafeng" %% "testcontainers-scala-mysql" % testcontainersVersion % Test,
"mysql" % "mysql-connector-java" % "8.0.32" % Test,
"com.h2database" % "h2" % "2.1.214" % Test,
"mysql" % "mysql-connector-java" % "8.0.33" % Test,
AugustNagro marked this conversation as resolved.
Show resolved Hide resolved
"com.h2database" % "h2" % "2.3.232" % Test,
"com.dimafeng" %% "testcontainers-scala-oracle-xe" % testcontainersVersion % Test,
"com.oracle.database.jdbc" % "ojdbc11" % "21.9.0.0" % Test,
"com.oracle.database.jdbc" % "ojdbc11" % "23.5.0.24.07" % Test,
"com.dimafeng" %% "testcontainers-scala-clickhouse" % testcontainersVersion % Test,
"com.clickhouse" % "clickhouse-jdbc" % "0.4.1" % Test classifier "http",
"org.xerial" % "sqlite-jdbc" % "3.41.0.0" % Test
"com.clickhouse" % "clickhouse-jdbc" % "0.6.0" % Test classifier "http",
AugustNagro marked this conversation as resolved.
Show resolved Hide resolved
"org.xerial" % "sqlite-jdbc" % "3.46.1.3" % Test
)
)

Expand All @@ -67,8 +69,8 @@ lazy val magnumPg = project
Test / fork := true,
publish / skip := false,
libraryDependencies ++= Seq(
"org.postgresql" % "postgresql" % "42.6.0" % "provided",
"org.scalameta" %% "munit" % "0.7.29" % Test,
"org.postgresql" % "postgresql" % "42.7.4" % "provided",
"org.scalameta" %% "munit" % "1.0.2" % Test,
"com.dimafeng" %% "testcontainers-scala-munit" % testcontainersVersion % Test,
"com.dimafeng" %% "testcontainers-scala-postgresql" % testcontainersVersion % Test
)
Expand Down
4 changes: 2 additions & 2 deletions magnum-pg/src/test/scala/PgCodecTests.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import com.dimafeng.testcontainers.PostgreSQLContainer
import com.dimafeng.testcontainers.munit.fixtures.TestContainersFixtures
import munit.FunSuite
import munit.{AnyFixture, FunSuite}
import org.testcontainers.utility.DockerImageName
import org.postgresql.ds.PGSimpleDataSource
import org.postgresql.geometric.*
Expand Down Expand Up @@ -147,7 +147,7 @@ class PgCodecTests extends FunSuite, TestContainersFixtures:
.createContainer()
)

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[AnyFixture[_]] =
super.munitFixtures :+ pgContainer

def ds(): DataSource =
Expand Down
10 changes: 3 additions & 7 deletions magnum/src/test/scala/ClickHouseTests.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import com.augustnagro.magnum.*
import com.dimafeng.testcontainers.munit.fixtures.TestContainersFixtures
import com.dimafeng.testcontainers.{
ClickHouseContainer,
ContainerDef,
JdbcDatabaseContainer
}
import munit.{FunSuite, Location, TestOptions}
import com.dimafeng.testcontainers.{ClickHouseContainer, ContainerDef, JdbcDatabaseContainer}
import munit.{AnyFixture, FunSuite, Location, TestOptions}
import com.clickhouse.jdbc.ClickHouseDataSource
import org.testcontainers.utility.DockerImageName

Expand Down Expand Up @@ -398,7 +394,7 @@ class ClickHouseTests extends FunSuite, TestContainersFixtures:
.createContainer()
)

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[AnyFixture[_]] =
super.munitFixtures :+ clickHouseContainer

def ds(): DataSource =
Expand Down
10 changes: 3 additions & 7 deletions magnum/src/test/scala/MySqlTests.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import com.augustnagro.magnum.*
import com.dimafeng.testcontainers.munit.fixtures.TestContainersFixtures
import com.dimafeng.testcontainers.{
ContainerDef,
JdbcDatabaseContainer,
MySQLContainer
}
import com.dimafeng.testcontainers.{ContainerDef, JdbcDatabaseContainer, MySQLContainer}
import com.mysql.cj.jdbc.MysqlDataSource
import munit.{FunSuite, Location, TestOptions}
import munit.{AnyFixture, FunSuite, Location, TestOptions}
import org.testcontainers.utility.DockerImageName

import java.nio.file.{Files, Path}
Expand Down Expand Up @@ -398,7 +394,7 @@ class MySqlTests extends FunSuite, TestContainersFixtures:
.createContainer()
)

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[AnyFixture[_]] =
super.munitFixtures :+ mySqlContainer

def ds(): DataSource =
Expand Down
4 changes: 2 additions & 2 deletions magnum/src/test/scala/OracleTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import com.augustnagro.magnum.*
import com.augustnagro.magnum.UUIDCodec.VarCharUUIDCodec
import com.dimafeng.testcontainers.OracleContainer
import com.dimafeng.testcontainers.munit.fixtures.TestContainersFixtures
import munit.FunSuite
import munit.{AnyFixture, FunSuite}
import org.testcontainers.utility.DockerImageName
import oracle.jdbc.datasource.impl.OracleDataSource

Expand Down Expand Up @@ -398,7 +398,7 @@ class OracleTests extends FunSuite, TestContainersFixtures:
.createContainer()
)

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[AnyFixture[_]] =
super.munitFixtures :+ oracleContainer

def ds(): DataSource =
Expand Down
10 changes: 3 additions & 7 deletions magnum/src/test/scala/PgTests.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import com.augustnagro.magnum.*
import com.dimafeng.testcontainers.munit.fixtures.TestContainersFixtures
import com.dimafeng.testcontainers.{
ContainerDef,
JdbcDatabaseContainer,
PostgreSQLContainer
}
import munit.{FunSuite, Location, TestOptions}
import com.dimafeng.testcontainers.{ContainerDef, JdbcDatabaseContainer, PostgreSQLContainer}
import munit.{AnyFixture, FunSuite, Location, TestOptions}
import org.postgresql.ds.PGSimpleDataSource
import org.testcontainers.utility.DockerImageName

Expand Down Expand Up @@ -486,7 +482,7 @@ class PgTests extends FunSuite, TestContainersFixtures:
noIdRepo.insert(entity)
assert(noIdRepo.findAll.exists(_.userName == "Dan"))

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[AnyFixture[_]] =
super.munitFixtures :+ pgContainer

def ds(): DataSource =
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.9
sbt.version=1.10.2