Skip to content
Closed
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import java.nio.charset.StandardCharsets
import java.nio.file.{Files, Paths}

import scala.sys.process._
import scala.util.control.NonFatal

import org.apache.hadoop.conf.Configuration

Expand Down Expand Up @@ -169,6 +170,10 @@ class HiveExternalCatalogVersionsSuite extends SparkSubmitTestUtils {
""".stripMargin.getBytes("utf8"))
// scalastyle:on line.size.limit

if (PROCESS_TABLES.testingVersions.isEmpty) {
fail("Fail to get the lates Spark versions to test.")
}

PROCESS_TABLES.testingVersions.zipWithIndex.foreach { case (version, index) =>
val sparkHome = new File(sparkTestingDir, s"spark-$version")
if (!sparkHome.exists()) {
Expand Down Expand Up @@ -206,7 +211,19 @@ class HiveExternalCatalogVersionsSuite extends SparkSubmitTestUtils {

object PROCESS_TABLES extends QueryTest with SQLTestUtils {
// Tests the latest version of every release line.
val testingVersions = Seq("2.3.3", "2.4.2")
val testingVersions: Seq[String] = {
import scala.io.Source
try {
Source.fromURL("https://dist.apache.org/repos/dist/release/spark/").mkString
.split("\n")
.filter(_.contains("""<li><a href="spark-"""))
.map("""<a href="spark-(\d.\d.\d)/">""".r.findFirstMatchIn(_).get.group(1))
.filter(_ < org.apache.spark.SPARK_VERSION)
} catch {
// do not throw exception during object initialization.
case NonFatal(_) => Nil
}
}

protected var spark: SparkSession = _

Expand Down