Fix test run
All checks were successful
run-tests

This commit is contained in:
karthik 2023-04-09 18:50:20 +02:00
parent 5b67edca62
commit 7c2fca490a
3 changed files with 25 additions and 14 deletions

View File

@ -2,8 +2,8 @@ plugins {
id "scala"
}
group "${projectGroup}"
version "${projectVersion}"
group projectGroup
version projectVersion
repositories {
mavenCentral()
@ -12,10 +12,10 @@ repositories {
dependencies {
compileOnly group: "org.scala-lang", name:"scala-library", version: "${scalaMajorVersion}.${scalaMinorVersion}"
compileOnly group: "org.apache.spark", name: "spark-core_${scalaMajorVersion}", version: "${apacheSparkVersion}"
compileOnly group: "org.apache.spark", name: "spark-sql_${scalaMajorVersion}", version: "${apacheSparkVersion}"
compileOnly group: "org.apache.spark", name: "spark-core_${scalaMajorVersion}", version: apacheSparkVersion
compileOnly group: "org.apache.spark", name: "spark-sql_${scalaMajorVersion}", version: apacheSparkVersion
testImplementation group: "org.scalatest", name: "scalatest_${scalaMajorVersion}", version: "${scalaTestVersion}"
testImplementation group: "org.scalatest", name: "scalatest_${scalaMajorVersion}", version: scalaTestVersion
}
configurations {
@ -26,18 +26,18 @@ tasks.withType(ScalaCompile).configureEach {
scalaCompileOptions.additionalParameters = ["-release:${JavaVersion.current()}".toString()]
}
tasks.register('scalaTest', JavaExec) {
dependsOn['testClasses']
mainClass = 'org.scalatest.tools.Runner'
args = ['-R', 'build/classes/scala/test', '-o']
jvmArgs = ['--add-exports=java.base/sun.nio.ch=ALL-UNNAMED'] // https://lists.apache.org/thread/p1yrwo126vjx5tht82cktgjbmm2xtpw9
tasks.register("scalaTest", JavaExec) {
dependsOn["testClasses"]
mainClass = "org.scalatest.tools.Runner"
args = ["-R", "build/classes/scala/test", "-o"]
jvmArgs = ["--add-exports=java.base/sun.nio.ch=ALL-UNNAMED"] // https://lists.apache.org/thread/p1yrwo126vjx5tht82cktgjbmm2xtpw9
classpath = sourceSets.test.runtimeClasspath
}
test.dependsOn scalaTest
jar {
manifest {
attributes "Main-Class": "${mainClass}"
attributes "Main-Class": mainClass
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
@ -45,6 +45,12 @@ jar {
archiveFileName.set("${getArchiveBaseName().get()}-${projectVersion}.${getArchiveExtension().get()}")
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(targetJVM)
}
}
clean.doFirst {
delete "logs/"
}

View File

@ -1,12 +1,13 @@
apacheSparkVersion=3.3.2
scalaMajorVersion=2.13
scalaMinorVersion=10
scalaTestVersion=3.2.15
apacheSparkVersion=3.3.2
mainClass=com.barrelsofdata.sparkexamples.Driver
projectGroup=com.barrelsofdata.sparkexamples
projectVersion=1.0
targetJVM=17
org.gradle.daemon=false
org.gradle.jvmargs=-Xms128m -Xmx256m -XX:+UseSerialGC -Dfile.encoding=UTF-8
org.gradle.warning.mode=all

View File

@ -25,7 +25,11 @@ class DriverTest extends AnyFunSuite with BeforeAndAfterAll {
override def beforeAll(): Unit = {
setupLogger()
LOG.info("Setting up spark session")
spark = SparkSession.builder().appName(JOB_NAME).master("local[*]").getOrCreate()
spark = SparkSession.builder()
.appName(JOB_NAME)
.master("local[*]")
.config("spark.testing.memory", 471859200)
.getOrCreate()
}
override def afterAll(): Unit = {