Skip to content

Commit 5dbe4d8

Browse files
committed
Migrate to IntegrationTestKitSpec
1 parent c5f268c commit 5dbe4d8

8 files changed

+126
-127
lines changed

build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ gradlePlugin {
9191
implementationClass= 'nebula.plugin.info.reporting.InfoJarManifestPlugin'
9292
tags.set(['nebula', 'info'])
9393
}
94+
infoJARProperties {
95+
id = 'com.netflix.nebula.info-jar-properties'
96+
displayName = 'Gradle Info JAR properties plugin'
97+
description = project.description
98+
implementationClass= 'nebula.plugin.info.reporting.InfoJarPropertiesFilePlugin'
99+
tags.set(['nebula', 'info'])
100+
}
94101
infoJava {
95102
id = 'com.netflix.nebula.info-java'
96103
displayName = 'Gradle Info Java plugin'

src/test/groovy/nebula/plugin/info/BaseIntegrationSpec.groovy

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/test/groovy/nebula/plugin/info/InfoBrokerPluginIntegrationSpec.groovy

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ package nebula.plugin.info
1818

1919
import nebula.test.functional.ExecutionResult
2020

21-
class InfoBrokerPluginIntegrationSpec extends BaseIntegrationSpec {
21+
class InfoBrokerPluginIntegrationSpec extends BaseIntegrationTestKitSpec {
2222

2323
def 'it returns build reports at the end of the build'() {
2424
given:
2525
def report = 'This string may only be retrieved after the build has finished'
2626
buildFile << """
27-
${applyPlugin(InfoBrokerPlugin)}
27+
plugins {
28+
id 'com.netflix.nebula.info-broker'
29+
}
2830
2931
def broker = project.plugins.getPlugin(${InfoBrokerPlugin.name})
3032
@@ -42,10 +44,10 @@ class InfoBrokerPluginIntegrationSpec extends BaseIntegrationSpec {
4244
new File(projectDir, 'gradle.properties').text = '''org.gradle.configuration-cache=false'''.stripIndent()
4345

4446
when:
45-
ExecutionResult result = runTasksSuccessfully('createReport')
47+
def result = runTasks('createReport')
4648

4749
then:
48-
result.standardOutput.contains(report)
50+
result.output.contains(report)
4951
}
5052

5153

src/test/groovy/nebula/plugin/info/InfoPluginIntegrationSpec.groovy

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
*/
1616
package nebula.plugin.info
1717

18-
import nebula.test.functional.ExecutionResult
1918

20-
class InfoPluginIntegrationSpec extends BaseIntegrationSpec {
19+
class InfoPluginIntegrationSpec extends BaseIntegrationTestKitSpec {
2120
def 'it returns build reports at the end of the build'() {
2221
given:
2322
buildFile << """
@@ -30,8 +29,10 @@ class InfoPluginIntegrationSpec extends BaseIntegrationSpec {
3029
}
3130
}
3231
33-
${applyPlugin(InfoPlugin)}
34-
apply plugin: 'java'
32+
plugins {
33+
id 'com.netflix.nebula.info'
34+
id 'java'
35+
}
3536
3637
repositories { mavenCentral() }
3738
dependencies {
@@ -51,17 +52,20 @@ class InfoPluginIntegrationSpec extends BaseIntegrationSpec {
5152
new File(projectDir, 'gradle.properties').text = '''org.gradle.configuration-cache=false'''.stripIndent()
5253

5354
when:
54-
ExecutionResult result = runTasksSuccessfully('assemble')
55+
def result = runTasks('assemble')
5556

5657
then:
57-
result.standardOutput.contains('{buildscript-singlemodule-test-dependencies={Resolved-Dependencies-CompileClasspath=com.google.guava:guava:18.0}}')
58+
result.output.contains('{buildscript-singlemodule-test-dependencies={Resolved-Dependencies-CompileClasspath=com.google.guava:guava:18.0}}')
5859
}
5960

6061
def 'it returns build reports at the end of multiproject build'() {
6162
given:
6263
buildFile << """
64+
plugins {
65+
id 'com.netflix.nebula.info'
66+
}
6367
allprojects {
64-
${applyPlugin(InfoPlugin)}
68+
apply plugin: 'com.netflix.nebula.info'
6569
}
6670
6771
subprojects {
@@ -91,32 +95,23 @@ class InfoPluginIntegrationSpec extends BaseIntegrationSpec {
9195
new File(projectDir, 'gradle.properties').text = '''org.gradle.configuration-cache=false'''.stripIndent()
9296

9397
when:
94-
ExecutionResult result = runTasksSuccessfully('build')
98+
def result = runTasks('build')
9599

96100
then:
97-
result.standardOutput.contains('common-dependencies={Resolved-Dependencies-CompileClasspath=com.google.guava:guava:18.0}')
98-
result.standardOutput.contains('app-dependencies={Resolved-Dependencies-CompileClasspath=com.google.guava:guava:19.0}')
101+
result.output.contains('common-dependencies={Resolved-Dependencies-CompileClasspath=com.google.guava:guava:18.0}')
102+
result.output.contains('app-dependencies={Resolved-Dependencies-CompileClasspath=com.google.guava:guava:19.0}')
99103
}
100104

101105
def 'works with jenkins jpi plugin'() {
102106
given:
103107
System.setProperty("ignoreDeprecations", 'true')
104108
buildFile << """
105-
buildscript {
106-
repositories {
107-
maven {
108-
url "https://plugins.gradle.org/m2/"
109-
}
110-
}
111-
dependencies {
112-
classpath "org.jenkins-ci.tools:gradle-jpi-plugin:0.49.0"
113-
}
109+
plugins {
110+
id 'com.netflix.nebula.info'
111+
id 'java'
112+
id "org.jenkins-ci.jpi" version "0.50.0-rc.3"
114113
}
115-
116-
${applyPlugin(InfoPlugin)}
117-
apply plugin: 'java'
118-
apply plugin: "org.jenkins-ci.jpi"
119-
114+
120115
jenkinsPlugin {
121116
jenkinsVersion.set('2.249.3')
122117
}
@@ -134,10 +129,7 @@ class InfoPluginIntegrationSpec extends BaseIntegrationSpec {
134129
// JPI plugin might not be configuration cache compatible yet
135130
new File(projectDir, 'gradle.properties').text = '''org.gradle.configuration-cache=false'''.stripIndent()
136131

137-
when:
138-
ExecutionResult result = runTasksSuccessfully('assemble')
139-
140-
then:
141-
result.success
132+
expect:
133+
runTasks('assemble')
142134
}
143135
}

src/test/groovy/nebula/plugin/info/InfoPluginIntegrationTestKitSpec.groovy

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class InfoPluginIntegrationTestKitSpec extends BaseIntegrationTestKitSpec {
6161

6262
def 'reports proper jdk version when configuring toolchain in compile task'() {
6363
given:
64-
debug = true
6564
buildFile << """
6665
buildscript {
6766
repositories {
@@ -112,7 +111,6 @@ class InfoPluginIntegrationTestKitSpec extends BaseIntegrationTestKitSpec {
112111

113112
def 'reports proper jdk version when configuring target/source compatibility in compile task + toolchains'() {
114113
given:
115-
debug = true
116114
buildFile << """
117115
buildscript {
118116
repositories {
@@ -165,7 +163,6 @@ class InfoPluginIntegrationTestKitSpec extends BaseIntegrationTestKitSpec {
165163

166164
def 'reports proper jdk version when configuring target/source compatibility in compile task + toolchains (multi language)'() {
167165
given:
168-
debug = true
169166
buildFile << """
170167
buildscript {
171168
repositories {
@@ -221,7 +218,6 @@ class InfoPluginIntegrationTestKitSpec extends BaseIntegrationTestKitSpec {
221218
222219
def 'reports proper jdk version when configuring target/source compatibility in compile task + toolchains (scala support)'() {
223220
given:
224-
debug = true
225221
buildFile << """
226222
buildscript {
227223
repositories {

src/test/groovy/nebula/plugin/info/ci/ContinuousIntegrationInfoPluginSpec.groovy

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package nebula.plugin.info.ci
22

3-
import nebula.plugin.info.BaseIntegrationSpec
4-
import nebula.plugin.info.InfoBrokerPlugin
5-
import nebula.plugin.info.reporting.InfoJarManifestPlugin
6-
import nebula.test.IntegrationSpec
3+
import nebula.plugin.info.BaseIntegrationTestKitSpec
74
import org.junit.Rule
85
import org.junit.contrib.java.lang.system.EnvironmentVariables
96
import spock.lang.IgnoreIf
@@ -14,7 +11,7 @@ import java.util.jar.JarFile
1411
import java.util.jar.Manifest
1512

1613
@IgnoreIf({ System.getenv('TITUS_TASK_ID') || jvm.isJava21() || jvm.isJava17() })
17-
class ContinuousIntegrationInfoPluginSpec extends BaseIntegrationSpec {
14+
class ContinuousIntegrationInfoPluginSpec extends BaseIntegrationTestKitSpec {
1815

1916
@Rule
2017
public final EnvironmentVariables environmentVariables = new EnvironmentVariables()
@@ -28,17 +25,19 @@ class ContinuousIntegrationInfoPluginSpec extends BaseIntegrationSpec {
2825

2926
writeHelloWorld('nebula.test')
3027
buildFile << """
31-
${applyPlugin(InfoBrokerPlugin)}
32-
${applyPlugin(ContinuousIntegrationInfoPlugin)}
33-
${applyPlugin(InfoJarManifestPlugin)}
28+
plugins {
29+
id 'com.netflix.nebula.info-broker'
30+
id 'com.netflix.nebula.info-ci'
31+
id 'com.netflix.nebula.info-jar'
32+
}
3433
3534
apply plugin: 'java'
3635
3736
version = '1.0'
3837
""".stripIndent()
3938

4039
when:
41-
runTasksSuccessfully('jar')
40+
runTasks('jar')
4241

4342
then:
4443
File jarFile = new File(projectDir, "build/libs/${moduleName}-1.0.jar")

0 commit comments

Comments
 (0)