Skip to content

Commit

Permalink
Merge pull request #13226 from matrei/matrei/modernise-uber-test-suite
Browse files Browse the repository at this point in the history
Modernise uber test suite build file
  • Loading branch information
puneetbehl authored Nov 23, 2023
2 parents a81876e + a0a7f2f commit f48afd6
Showing 1 changed file with 44 additions and 56 deletions.
100 changes: 44 additions & 56 deletions grails-test-suite-uber/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
configurations.testCompileClasspath {
exclude module: "grails-plugin-testing"
exclude module: 'grails-plugin-testing'
}

dependencies {
Expand Down Expand Up @@ -86,66 +86,54 @@ dependencies {
}
}

test {
maxParallelForks = isCiBuild ? 2 : 4
forkEvery = isCiBuild ? 25 : 100
if(!isCiBuild) {
maxHeapSize = '1024m'
}
excludes = [
"**/grails/test/PersonTests.class",
"**/rest/render/**/*Spec.class",
"**/*TestCase.class",
"**/DataSourceGrailsPluginTests",
"**/DefaultGrailsControllerClassTests.class",
"**/GrailsUnitTestCaseTests.class",
"**/SetupTeardownInvokeTests.class",
"**/TestMixinSetupTeardownInvokeTests.class",
"**/UrlMappingsTestMixinTests.class",
"**/WebUtilsTests.class",
"**/RestfulControllerSpec.class",
"**/ResourceAnnotationRestfulControllerSpec.class",
"**/TestingValidationSpec.class",
"**/CascadingErrorCountSpec"
]
}

task isolatedTestsOne(type:Test) {
includes = [
"**/DataSourceGrailsPluginTests.class",
"**/GrailsUnitTestCaseTests.class",
"**/WebUtilsTests.class"
]
}

task isolatedTestsTwo(type:Test) {
maxParallelForks = 1
forkEvery = 100
includes = [
"**/UrlMappingsTestMixinTests.class",
"**/SetupTeardownInvokeTests.class",
"**/TestMixinSetupTeardownInvokeTests.class"
def isolatedTestPatterns = [
isolatedTestsOne: [
'org.grails.core.DefaultGrailsControllerClassSpec',
'org.grails.web.util.WebUtilsTests'
],
isolatedTestsTwo: [
'grails.test.mixin.UrlMappingsTestMixinTests',
'grails.test.mixin.SetupTeardownInvokeTests',
'grails.test.mixin.TestMixinSetupTeardownInvokeTests'
],
isolatedRestRendererTests: [
'*.rest.render.*Spec'
],
isolatedPersonTests: [
'org.grails.validation.TestingValidationSpec',
'org.grails.validation.CascadingErrorCountSpec'
],
isolatedRestfulControllerTests: [
'grails.test.mixin.RestfulControllerSpec',
'grails.test.mixin.ResourceAnnotationRestfulControllerSpec'
]
}

task isolatedRestRendererTests(type:Test) {
includes = ['**/rest/render/**/*Spec.class']
}
]

task isolatedDefaultGrailsControllerClassTests(type: Test) {
includes = ['**/DefaultGrailsControllerClassTests.class']
tasks.withType(Test).configureEach {
maxParallelForks = isCiBuild ? 2 : 4
forkEvery = isCiBuild ? 25 : 100
if(!isCiBuild) {
maxHeapSize = '1024m'
}
}

task isolatedPersonTests(type: Test) {
includes = ['**/grails/test/PersonTests.class',
"**/TestingValidationSpec.class",
"**/CascadingErrorCountSpec"
]
tasks.named('test', Test) {
filter.excludePatterns = isolatedTestPatterns.values().flatten()
dependsOn(provider {
tasks.findAll({
isolatedTestPatterns.containsKey(it.name)
})
})
}

task isolatedRestfulControllerTests(type:Test) {
includes = ["**/RestfulControllerSpec.class",
"**/ResourceAnnotationRestfulControllerSpec.class"]
isolatedTestPatterns.keySet().each { taskName ->
tasks.register(taskName, Test) {
group = 'verification'
filter.includePatterns = isolatedTestPatterns[taskName]
}
}

test.dependsOn isolatedPersonTests, isolatedTestsOne, isolatedTestsTwo, isolatedRestRendererTests, isolatedDefaultGrailsControllerClassTests, isolatedRestfulControllerTests
tasks.named('isolatedTestsTwo', Test) {
maxParallelForks = 1
forkEvery = 100
}

0 comments on commit f48afd6

Please sign in to comment.