Skip to content

Commit

Permalink
fix(tests): Introduce junit5 vintage engine for running junit4 test c…
Browse files Browse the repository at this point in the history
…ases over junit5 in rosco (spinnaker#958)

Spring boot 2.4.x removed JUnit5 vintage engine from spring-boot-starter-test.
[https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.4-Release-Notes#junit-5s-vintage-engine-removed-from-spring-boot-starter-test]
It is required for executing junit4 based test cases in rosco.
So, introducing junit-vintage-engine dependency in build.gradle, using testRuntimeOnly() as suggested in section 3.1 of https://junit.org/junit5/docs/5.6.2/user-guide/index.pdf

After applying this fix, coverage increased from 217 to 252 test case executions.
  • Loading branch information
j-sandy authored and nemesisOsorio committed Apr 26, 2024
1 parent fba73e1 commit 76084ae
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
36 changes: 18 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'io.spinnaker.project' version "$spinnakerGradleVersion" apply false
id 'io.spinnaker.project' version "$spinnakerGradleVersion" apply false
}

allprojects {
Expand All @@ -11,22 +11,22 @@ allprojects {
}

subprojects {
group = "io.spinnaker.rosco"
group = "io.spinnaker.rosco"

if (name != "rosco-bom") {
apply plugin: 'java-library'
apply plugin: "groovy"
if (name != "rosco-bom") {
apply plugin: 'java-library'
apply plugin: "groovy"

dependencies {
implementation enforcedPlatform("io.spinnaker.kork:kork-bom:$korkVersion")
dependencies {
implementation enforcedPlatform("io.spinnaker.kork:kork-bom:$korkVersion")

annotationProcessor platform("io.spinnaker.kork:kork-bom:$korkVersion")
annotationProcessor "org.projectlombok:lombok"
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testAnnotationProcessor platform("io.spinnaker.kork:kork-bom:$korkVersion")
testAnnotationProcessor "org.projectlombok:lombok"
testImplementation "org.springframework.boot:spring-boot-starter-test"
}
annotationProcessor platform("io.spinnaker.kork:kork-bom:$korkVersion")
annotationProcessor "org.projectlombok:lombok"
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testAnnotationProcessor platform("io.spinnaker.kork:kork-bom:$korkVersion")
testAnnotationProcessor "org.projectlombok:lombok"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine"
}

test {
testLogging {
Expand Down Expand Up @@ -56,11 +56,11 @@ subprojects {
}
}

tasks.withType(JavaExec) {
if (System.getProperty('DEBUG', 'false') == 'true') {
jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8187'
}
tasks.withType(JavaExec) {
if (System.getProperty('DEBUG', 'false') == 'true') {
jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8187'
}
}
}

defaultTasks ':rosco-web:run'
6 changes: 3 additions & 3 deletions rosco-web/rosco-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ apply plugin: "groovy"
mainClassName = 'com.netflix.spinnaker.rosco.Main'

configurations.all {
//exclude group: 'javax.servlet', module: 'servlet-api'
exclude group: "org.slf4j", module: "slf4j-log4j12"
}

Expand All @@ -20,14 +19,15 @@ dependencies {
implementation "org.springframework.security:spring-security-core"
compileOnly "org.springframework.boot:spring-boot-starter-actuator"
implementation "io.spinnaker.kork:kork-config"


compileOnly 'org.apache.tomcat:tomcat-servlet-api:11.0.0-M4'

api "org.apache.groovy:groovy:4.0.9"
implementation "io.spinnaker.kork:kork-artifacts"
implementation "net.logstash.logback:logstash-logback-encoder:4.11"
implementation "io.spinnaker.kork:kork-config"
//implementation "org.springframework.boot:spring-boot-starter-web"
// implementation "net.logstash.logback:logstash-logback-encoder"


runtimeOnly "io.spinnaker.kork:kork-runtime"

Expand Down

0 comments on commit 76084ae

Please sign in to comment.