Skip to content

Commit

Permalink
chore: migrate to native test suites
Browse files Browse the repository at this point in the history
  • Loading branch information
clemstoquart committed May 1, 2023
1 parent 19feedb commit cf81b6f
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 45 deletions.
85 changes: 70 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id("ekino.oss.kotlin-library")
id("ekino.oss.maven-central-publishing")
id("ekino.oss.test")
`jvm-test-suite`
}

version = "9.0.1-SNAPSHOT"
Expand All @@ -12,8 +12,6 @@ repositories {

val springBootVersion = "3.0.6"
val awsSdkVersion = "2.20.51"
val jcvVersion = "1.5.0"
val assertkVersion = "0.25"

dependencies {
implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) // BOM import
Expand All @@ -30,23 +28,80 @@ dependencies {
compileOnly("org.springframework.boot:spring-boot-starter-data-rest")
compileOnly("org.springframework.security:spring-security-web")
compileOnly("software.amazon.awssdk:s3:$awsSdkVersion")
}

// move it back to its own file in the buildsrc folder when sharing version catalog is possible
testing {
suites {
configureEach {
if (this is JvmTestSuite) {
useJUnitJupiter()
dependencies {
implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion"))
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")

testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("com.ekino.oss.jcv:jcv-hamcrest:$jcvVersion")
testImplementation("com.willowtreeapps.assertk:assertk-jvm:$assertkVersion")
implementation("org.springframework.boot:spring-boot-starter-test")
implementation("com.ekino.oss.jcv:jcv-hamcrest:1.5.0")
implementation("com.willowtreeapps.assertk:assertk-jvm:0.25")
}
}
}

securityTestImplementation("org.springframework.security:spring-security-web")
val securityTest by registering(JvmTestSuite::class) {
dependencies {
implementation(project())
implementation("org.springframework.security:spring-security-web")
}
sources {
java {
setSrcDirs(listOf("src/securityTest/kotlin"))
}
}
}

dataRestTestImplementation("org.springframework.boot:spring-boot-starter-data-rest")
val dataRestTest by registering(JvmTestSuite::class) {
dependencies {
implementation(project())
implementation("org.springframework.boot:spring-boot-starter-data-rest")
}
sources {
java {
setSrcDirs(listOf("src/dataRestTest/kotlin"))
}
}
}

txTestImplementation("org.springframework.boot:spring-boot-starter-data-jpa")
val txTest by registering(JvmTestSuite::class) {
dependencies {
implementation(project())
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
}
sources {
java {
setSrcDirs(listOf("src/txTest/kotlin"))
}
}
}

awsTestImplementation("software.amazon.awssdk:s3:$awsSdkVersion")
val awsTest by registering(JvmTestSuite::class) {
dependencies {
implementation(project())
implementation("software.amazon.awssdk:s3:$awsSdkVersion")
}
sources {
java {
setSrcDirs(listOf("src/awsTest/kotlin"))
}
}
}
}
}

configurations {
all {
exclude(module = "mockito-core")
exclude(module = "assertj-core")
}
tasks.named("build") {
dependsOn(testing.suites.named("securityTest"))
dependsOn(testing.suites.named("dataRestTest"))
dependsOn(testing.suites.named("txTest"))
dependsOn(testing.suites.named("awsTest"))
}
1 change: 0 additions & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion") // required by kotlin("plugin.spring")
implementation("gradle.plugin.com.ekino.oss.plugin:kotlin-quality-plugin:3.2.0") // required by id("com.ekino.oss.plugin.kotlin-quality")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:$kotlinVersion") // required by id("org.jetbrains.dokka")
implementation("org.unbroken-dome.gradle-plugins:gradle-testsets-plugin:4.0.0") // required by id("org.unbroken-dome.test-sets")
}
22 changes: 0 additions & 22 deletions buildSrc/src/main/kotlin/ekino.oss.test.gradle.kts

This file was deleted.

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=7ba68c54029790ab444b39d7e293d3236b2632631fb5f2e012bb28b4ff669e4b
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
11 changes: 6 additions & 5 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -144,15 +141,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down

0 comments on commit cf81b6f

Please sign in to comment.