diff --git a/externals/kyuubi-jdbc-engine/src/test/scala/org/apache/kyuubi/engine/jdbc/oracle/WithOracleContainer.scala b/externals/kyuubi-jdbc-engine/src/test/scala/org/apache/kyuubi/engine/jdbc/oracle/WithOracleContainer.scala index 80f4313e55c..ed5217cef8d 100644 --- a/externals/kyuubi-jdbc-engine/src/test/scala/org/apache/kyuubi/engine/jdbc/oracle/WithOracleContainer.scala +++ b/externals/kyuubi-jdbc-engine/src/test/scala/org/apache/kyuubi/engine/jdbc/oracle/WithOracleContainer.scala @@ -17,19 +17,39 @@ package org.apache.kyuubi.engine.jdbc.oracle -import com.dimafeng.testcontainers.OracleContainer -import org.testcontainers.utility.DockerImageName +// import java.time.Duration + +import com.dimafeng.testcontainers.GenericContainer +import org.testcontainers.containers.wait.strategy.{Wait, WaitAllStrategy} import org.apache.kyuubi.engine.jdbc.WithJdbcServerContainer trait WithOracleContainer extends WithJdbcServerContainer { - - private val oracleDockerImage = "gvenzl/oracle-xe:18.4.0-slim" + private val oraclePort = 1521 + private val ports = Seq(oraclePort) + private val oracleDockerImage = "gvenzl/oracle-free:23.5-slim" + private val oracleUsernameKey = "APP_USER" + private val oraclePasswordKey = "APP_USER_PASSWORD" protected val oracleUserName = "kyuubi" protected val oraclePassword = "oracle" - override val containerDef = OracleContainer.Def( - dockerImageName = DockerImageName.parse(oracleDockerImage), - username = oracleUserName, - password = oraclePassword) + override val containerDef: GenericContainer.Def[GenericContainer] = GenericContainer.Def( + dockerImage = oracleDockerImage, + exposedPorts = ports, + waitStrategy = new WaitAllStrategy() + // .withStartupTimeout(Duration.ofMinutes(1)) + .withStrategy(Wait.forListeningPort()) + .withStrategy(Wait.forLogMessage( + "Completed: Pluggable database FREEPDB1 opened read write", 1)) + , + env = Map( + oraclePasswordKey -> oraclePassword, + oracleUsernameKey -> oracleUserName, + "ORACLE_RANDOM_PASSWORD" -> "true")) + + protected def oracleJdbcUrl: String = withContainers { container => + val queryServerHost: String = container.host + val queryServerPort: Int = container.mappedPort(oraclePort) + s"jdbc:oracle:thin:@//$queryServerHost:$queryServerPort/FREEPDB1" + } } diff --git a/externals/kyuubi-jdbc-engine/src/test/scala/org/apache/kyuubi/engine/jdbc/oracle/WithOracleEngine.scala b/externals/kyuubi-jdbc-engine/src/test/scala/org/apache/kyuubi/engine/jdbc/oracle/WithOracleEngine.scala index 71498078eb5..d726028a31d 100644 --- a/externals/kyuubi-jdbc-engine/src/test/scala/org/apache/kyuubi/engine/jdbc/oracle/WithOracleEngine.scala +++ b/externals/kyuubi-jdbc-engine/src/test/scala/org/apache/kyuubi/engine/jdbc/oracle/WithOracleEngine.scala @@ -26,9 +26,9 @@ trait WithOracleEngine extends WithJdbcEngine with WithOracleContainer { override def withKyuubiConf: Map[String, String] = withContainers { container => Map( ENGINE_SHARE_LEVEL.key -> "SERVER", - ENGINE_JDBC_CONNECTION_URL.key -> container.jdbcUrl, - ENGINE_JDBC_CONNECTION_USER.key -> container.username, - ENGINE_JDBC_CONNECTION_PASSWORD.key -> container.password, + ENGINE_JDBC_CONNECTION_URL.key -> oracleJdbcUrl, + ENGINE_JDBC_CONNECTION_USER.key -> oracleUserName, + ENGINE_JDBC_CONNECTION_PASSWORD.key -> oraclePassword, ENGINE_TYPE.key -> "jdbc", ENGINE_JDBC_SHORT_NAME.key -> "oracle", FRONTEND_BIND_HOST.key -> "0.0.0.0",