From 244840831e3595acf46b4580c9748e3027683f58 Mon Sep 17 00:00:00 2001 From: Dongjoon Hyun Date: Mon, 22 Jun 2020 14:08:34 -0700 Subject: [PATCH 1/2] Adjust --- .../spark/sql/jdbc/DockerJDBCIntegrationSuite.scala | 4 +++- .../apache/spark/sql/jdbc/OracleIntegrationSuite.scala | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/DockerJDBCIntegrationSuite.scala b/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/DockerJDBCIntegrationSuite.scala index d15b366bfc9b..0fd645a83df5 100644 --- a/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/DockerJDBCIntegrationSuite.scala +++ b/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/DockerJDBCIntegrationSuite.scala @@ -28,6 +28,7 @@ import com.spotify.docker.client._ import com.spotify.docker.client.exceptions.ImageNotFoundException import com.spotify.docker.client.messages.{ContainerConfig, HostConfig, PortBinding} import org.scalatest.concurrent.Eventually +import org.scalatest.concurrent.PatienceConfiguration.Timeout import org.scalatest.time.SpanSugar._ import org.apache.spark.sql.test.SharedSparkSession @@ -95,6 +96,7 @@ abstract class DockerJDBCIntegrationSuite extends SharedSparkSession with Eventu protected val dockerIp = DockerUtils.getDockerIp() val db: DatabaseOnDocker + val connectionTimeout: Timeout = timeout(1.minute) private var docker: DockerClient = _ protected var externalPort: Int = _ @@ -155,7 +157,7 @@ abstract class DockerJDBCIntegrationSuite extends SharedSparkSession with Eventu docker.startContainer(containerId) jdbcUrl = db.getJdbcUrl(dockerIp, externalPort) var conn: Connection = null - eventually(timeout(2.minutes), interval(1.second)) { + eventually(connectionTimeout, interval(1.second)) { conn = getConnection() } // Run any setup queries: diff --git a/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/OracleIntegrationSuite.scala b/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/OracleIntegrationSuite.scala index c7200e139723..bf6e9186f0a6 100644 --- a/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/OracleIntegrationSuite.scala +++ b/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/OracleIntegrationSuite.scala @@ -21,6 +21,9 @@ import java.math.BigDecimal import java.sql.{Connection, Date, Timestamp} import java.util.{Properties, TimeZone} +import org.scalatest.concurrent.PatienceConfiguration.Timeout +import org.scalatest.time.SpanSugar._ + import org.apache.spark.sql.{Row, SaveMode} import org.apache.spark.sql.execution.{RowDataSourceScanExec, WholeStageCodegenExec} import org.apache.spark.sql.execution.datasources.LogicalRelation @@ -37,10 +40,7 @@ import org.apache.spark.tags.DockerTest * 2. export ORACLE_DOCKER_IMAGE_NAME=$ORACLE_DOCKER_IMAGE_NAME * Pull oracle $ORACLE_DOCKER_IMAGE_NAME image - docker pull $ORACLE_DOCKER_IMAGE_NAME * 3. Start docker - sudo service docker start - * 4. The timeout and interval parameter to be increased to a high value for oracle test in - * DockerJDBCIntegrationSuite.scala (Locally tested with 20 min timeout and 1 sec interval - * then executed successfully). - * 5. Run spark test - ./build/sbt -Pdocker-integration-tests + * 4. Run spark test - ./build/sbt -Pdocker-integration-tests * "test-only org.apache.spark.sql.jdbc.OracleIntegrationSuite" * * An actual sequence of commands to run the test is as follows @@ -71,6 +71,8 @@ class OracleIntegrationSuite extends DockerJDBCIntegrationSuite with SharedSpark s"jdbc:oracle:thin:system/oracle@//$ip:$port/xe" } + override val connectionTimeout: Timeout = timeout(10.minutes) + override def dataPreparation(conn: Connection): Unit = { // In 18.4.0 Express Edition auto commit is enabled by default. conn.setAutoCommit(false) From be4ab9a9b52db6659468294d2695680e0c1802c3 Mon Sep 17 00:00:00 2001 From: Dongjoon Hyun Date: Mon, 22 Jun 2020 14:16:07 -0700 Subject: [PATCH 2/2] a --- .../org/apache/spark/sql/jdbc/DockerJDBCIntegrationSuite.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/DockerJDBCIntegrationSuite.scala b/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/DockerJDBCIntegrationSuite.scala index 0fd645a83df5..75dedcf80fd4 100644 --- a/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/DockerJDBCIntegrationSuite.scala +++ b/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/DockerJDBCIntegrationSuite.scala @@ -96,7 +96,7 @@ abstract class DockerJDBCIntegrationSuite extends SharedSparkSession with Eventu protected val dockerIp = DockerUtils.getDockerIp() val db: DatabaseOnDocker - val connectionTimeout: Timeout = timeout(1.minute) + val connectionTimeout: Timeout = timeout(2.minute) private var docker: DockerClient = _ protected var externalPort: Int = _