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

fix: Integration tests not working correctly #806

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/mysql-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: ./scripts/launch-mysql.sh

- name: Run Integration tests for ${{ matrix.name }}
run: sbt "testOnly akka.persistence.jdbc.integration.MySQL*" ${{ matrix.extraOpts }} -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseJVMCICompiler
run: sbt "integration/testOnly akka.persistence.jdbc.integration.MySQL*" ${{ matrix.extraOpts }} -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseJVMCICompiler

- name: Print logs on failure
if: ${{ failure() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/oracle-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: ./scripts/launch-oracle.sh

- name: Run Integration tests for ${{ matrix.name }}
run: sbt "testOnly akka.persistence.jdbc.integration.Oracle*" ${{ matrix.extraOpts }} -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseJVMCICompiler
run: sbt "integration/testOnly akka.persistence.jdbc.integration.Oracle*" ${{ matrix.extraOpts }} -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseJVMCICompiler

- name: Print logs on failure
if: ${{ failure() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postgres-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: ./scripts/launch-postgres.sh

- name: Run Integration tests for ${{ matrix.name }}
run: sbt "testOnly akka.persistence.jdbc.integration.Postgres*" ${{ matrix.extraOpts }} -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseJVMCICompiler
run: sbt "integration/testOnly akka.persistence.jdbc.integration.Postgres*" ${{ matrix.extraOpts }} -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseJVMCICompiler

- name: Print logs on failure
if: ${{ failure() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sqlserver-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: ./scripts/launch-sqlserver.sh

- name: Run Integration tests for ${{ matrix.name }}
run: sbt "testOnly akka.persistence.jdbc.integration.SqlServer*" ${{ matrix.extraOpts }} -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseJVMCICompiler
run: sbt "integration/testOnly akka.persistence.jdbc.integration.SqlServer*" ${{ matrix.extraOpts }} -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseJVMCICompiler

- name: Print logs on failure
if: ${{ failure() }}
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ lazy val integration = project
.settings(IntegrationTests.settings)
.settings(name := "akka-persistence-jdbc-integration", libraryDependencies ++= Dependencies.Libraries)
.disablePlugins(MimaPlugin, SitePlugin, CiReleasePlugin)
.dependsOn(core)
.dependsOn(core % "compile->compile;test->test")

lazy val migrator = project
.in(file("migrator"))
Expand Down
5 changes: 5 additions & 0 deletions core/src/test/resources/mysql-application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jdbc-read-journal {
slick = ${slick}
}

# the akka-persistence-jdbc provider in use for durable state store
jdbc-durable-state-store {
slick = ${slick}
}

slick {
profile = "slick.jdbc.MySQLProfile$"
db {
Expand Down
5 changes: 5 additions & 0 deletions core/src/test/resources/mysql-shared-db-application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,8 @@ jdbc-snapshot-store {
jdbc-read-journal {
use-shared-db = "slick"
}

# the akka-persistence-jdbc provider in use for durable state store
jdbc-durable-state-store {
use-shared-db = "slick"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
package akka.persistence.jdbc.state.scaladsl

import com.typesafe.config.{ Config, ConfigFactory }
import scala.concurrent.duration._

import scala.concurrent.duration.*
import scala.concurrent.ExecutionContext
import scala.util.{ Failure, Success }
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpecLike
import org.scalatest.{ BeforeAndAfterAll, BeforeAndAfterEach }
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.time._

import akka.actor._
import org.scalatest.time.*
import akka.actor.*
import akka.persistence.jdbc.db.SlickDatabase
import akka.persistence.jdbc.config._
import akka.persistence.jdbc.testkit.internal.{ H2, Postgres, SchemaType }
import akka.persistence.jdbc.config.*
import akka.persistence.jdbc.testkit.internal.{ H2, MySQL, Postgres, SchemaType }
import akka.persistence.jdbc.util.DropCreate
import akka.serialization.SerializationExtension
import akka.util.Timeout
Expand All @@ -38,6 +38,7 @@ abstract class StateSpecBase(val config: Config, schemaType: SchemaType)
private[jdbc] def schemaTypeToProfile(s: SchemaType) = s match {
case H2 => slick.jdbc.H2Profile
case Postgres => slick.jdbc.PostgresProfile
case MySQL => slick.jdbc.MySQLProfile
case _ => ???
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ package akka.persistence.jdbc.integration
import com.typesafe.config.ConfigFactory
import akka.actor.ActorSystem
import akka.persistence.jdbc.state.scaladsl.JdbcDurableStateSpec
import akka.persistence.jdbc.testkit.internal.Mysql
import akka.persistence.jdbc.testkit.internal.MySQL
import org.scalatest.Ignore

// FIXME this test doesn't pass because of something with SequenceNextValUpdater
Copy link
Member

Choose a reason for hiding this comment

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

Issue for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I pinged the contributor in in the PR where he just added this the other day

@Ignore
class MySQLScalaJdbcDurableStateStoreQueryTest
extends JdbcDurableStateSpec(ConfigFactory.load("mysql-shared-db-application.conf"), MySQL) {
implicit lazy val system: ActorSystem =
ActorSystem("JdbcDurableStateSpec", config.withFallback(customSerializers))

}
77 changes: 39 additions & 38 deletions scripts/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
postgres:
image: postgres:latest
container_name: postgres-test
environment:
- "TZ=Europe/Amsterdam"
- "POSTGRES_USER=docker"
- "POSTGRES_PASSWORD=docker"
ports:
- "5432:5432" # credentials (docker:docker)
services:
postgres:
image: postgres:latest
container_name: postgres-test
environment:
- "TZ=Europe/Amsterdam"
- "POSTGRES_USER=docker"
- "POSTGRES_PASSWORD=docker"
ports:
- "5432:5432" # credentials (docker:docker)

mysql:
image: mysql:latest
container_name: mysql-test
environment:
- "TZ=Europe/Amsterdam"
- "MYSQL_ROOT_PASSWORD=root"
- "MYSQL_DATABASE=docker"
ports:
- "3306:3306" # credentials (root:root)
mysql:
image: mysql:latest
container_name: mysql-test
environment:
- "TZ=Europe/Amsterdam"
- "MYSQL_ROOT_PASSWORD=root"
- "MYSQL_DATABASE=docker"
ports:
- "3306:3306" # credentials (root:root)

oracle:
image: oracleinanutshell/oracle-xe-11g
container_name: oracle-test
environment:
- "TZ=Europe/Amsterdam"
- "DBCA_TOTAL_MEMORY=1024"
ports:
- "1521:1521" # DB_CONN: credentials (system:oracle)
oracle:
image: oracleinanutshell/oracle-xe-11g
container_name: oracle-test
environment:
- "TZ=Europe/Amsterdam"
- "DBCA_TOTAL_MEMORY=1024"
ports:
- "1521:1521" # DB_CONN: credentials (system:oracle)

sqlserver:
image: topaztechnology/mssql-server-linux
container_name: sqlserver-test
environment:
- "TZ=Europe/Amsterdam"
- "DBCA_TOTAL_MEMORY=1024"
- "ACCEPT_EULA=Y"
- "SQL_USER=docker"
- "SQL_PASSWORD=docker"
- "SQL_DB=docker"
ports:
- "1433:1433" # credentials (docker:docker)
sqlserver:
image: topaztechnology/mssql-server-linux
container_name: sqlserver-test
environment:
- "TZ=Europe/Amsterdam"
- "DBCA_TOTAL_MEMORY=1024"
- "ACCEPT_EULA=Y"
- "SQL_USER=docker"
- "SQL_PASSWORD=docker"
- "SQL_DB=docker"
ports:
- "1433:1433" # credentials (docker:docker)