11// SPDX-License-Identifier: Apache-2.0
2+ import org.gradlex.javamodule.dependencies.dsl.GradleOnlyDirectives
3+
24plugins {
3- id(" java-library" )
4- id(" jacoco" )
5- id(" org.hiero.gradle.base.jpms-modules" )
6- id(" org.hiero.gradle.base.lifecycle" )
7- id(" org.hiero.gradle.base.version" )
8- id(" org.hiero.gradle.check.dependencies" )
9- id(" org.hiero.gradle.check.javac-lint" )
10- id(" org.hiero.gradle.check.spotless" )
11- id(" org.hiero.gradle.check.spotless-java" )
12- id(" org.hiero.gradle.check.spotless-kotlin" )
13- id(" org.hiero.gradle.feature.git-properties-file" )
14- id(" org.hiero.gradle.feature.java-compile" )
15- id(" org.hiero.gradle.feature.java-execute" )
16- id(" org.hiero.gradle.feature.test" )
17- id(" org.hiero.gradle.report.test-logger" )
5+ id(" org.hiero.gradle.module.library" )
186 id(" org.hiero.gradle.feature.test-fixtures" )
197 id(" org.hiero.gradle.feature.test-integration" )
208 id(" org.hiero.gradle.feature.protobuf" )
219}
2210
2311description = " Consensus Otter Test Framework"
2412
13+ @Suppress(" UnstableApiUsage" )
14+ testing {
15+ javaModuleTesting.whitebox(suites[" test" ]) { //
16+ sourcesUnderTest = sourceSets.testFixtures.get()
17+ }
18+ javaModuleTesting.whitebox(suites[" testIntegration" ]) {
19+ sourcesUnderTest = sourceSets.testFixtures.get()
20+ }
21+ suites.register<JvmTestSuite >(" testOtter" ) {
22+ // Runs tests against the Container environment
23+ targets.register(" testContainer" ) {
24+ testTask {
25+ dependsOn(" :consensus-otter-docker-app:copyDockerizedApp" )
26+ systemProperty(" otter.env" , " container" )
27+ }
28+ }
29+
30+ // Runs tests against the Turtle environment
31+ targets.register(" testTurtle" ) { testTask { systemProperty(" otter.env" , " turtle" ) } }
32+ }
33+ }
34+
2535testModuleInfo {
2636 requires(" com.swirlds.base" )
2737 requires(" com.swirlds.base.test.fixtures" )
2838 requires(" com.swirlds.common.test.fixtures" )
2939 requires(" com.swirlds.platform.core.test.fixtures" )
30- requires(" org.hiero.otter.fixtures" )
3140 requires(" org.assertj.core" )
3241 requires(" org.junit.jupiter.params" )
3342 requires(" org.mockito" )
@@ -38,41 +47,6 @@ testModuleInfo {
3847 requires(" org.apache.logging.log4j" )
3948}
4049
41- testing.suites {
42- val testOtter by
43- registering(JvmTestSuite ::class ) {
44- useJUnitJupiter()
45-
46- dependencies {
47- implementation(project())
48- implementation(project.dependencies.testFixtures(project()))
49- implementation(project(" :swirlds-common" ))
50- implementation(project(" :swirlds-platform-core" ))
51- implementation(project(" :base-crypto" ))
52- implementation(" org.junit.jupiter:junit-jupiter-params" )
53- implementation(" com.github.spotbugs:spotbugs-annotations" )
54- runtimeOnly(" io.grpc:grpc-netty-shaded" )
55- }
56-
57- targets {
58- all {
59- testTask.configure {
60- // Disable all parallelism
61- systemProperty(" junit.jupiter.execution.parallel.enabled" , false )
62- systemProperty(
63- " junit.jupiter.testclass.order.default" ,
64- " org.junit.jupiter.api.ClassOrderer\$ OrderAnnotation" ,
65- )
66-
67- // Limit heap and number of processors
68- maxHeapSize = " 8g"
69- jvmArgs(" -XX:ActiveProcessorCount=6" )
70- }
71- }
72- }
73- }
74- }
75-
7650testIntegrationModuleInfo {
7751 requires(" com.swirlds.common.test.fixtures" )
7852 requires(" com.swirlds.logging" )
@@ -85,70 +59,15 @@ testIntegrationModuleInfo {
8559 runtimeOnly(" io.grpc.netty.shaded" )
8660}
8761
62+ extensions.getByName<GradleOnlyDirectives >(" testOtterModuleInfo" ).apply {
63+ runtimeOnly(" io.grpc.netty.shaded" )
64+ }
65+
66+ tasks.withType<Test >().configureEach { maxHeapSize = " 8g" }
67+
8868// This should probably not be necessary (Log4j issue?)
8969// https://github.com/apache/logging-log4j2/pull/3053
9070tasks.compileTestFixturesJava {
9171 options.compilerArgs.add(" -Alog4j.graalvm.groupId=${project.group} " )
9272 options.compilerArgs.add(" -Alog4j.graalvm.artifactId=${project.name} " )
9373}
94-
95- // Runs tests against the Turtle environment
96- tasks.register<Test >(" testTurtle" ) {
97- useJUnitPlatform()
98- testClassesDirs = sourceSets.named(" testOtter" ).get().output.classesDirs
99- classpath = sourceSets.named(" testOtter" ).get().runtimeClasspath
100-
101- // Disable all parallelism
102- systemProperty(" junit.jupiter.execution.parallel.enabled" , false )
103- systemProperty(
104- " junit.jupiter.testclass.order.default" ,
105- " org.junit.jupiter.api.ClassOrderer\$ OrderAnnotation" ,
106- )
107- // Tell our launcher to target a Turtle network
108- systemProperty(" otter.env" , " turtle" )
109-
110- // Limit heap and number of processors
111- maxHeapSize = " 8g"
112- jvmArgs(" -XX:ActiveProcessorCount=6" )
113- }
114-
115- // Runs tests against the Container environment
116- tasks.register<Test >(" testContainer" ) {
117- dependsOn(" :consensus-otter-docker-app:copyDockerizedApp" )
118-
119- useJUnitPlatform()
120- testClassesDirs = sourceSets.named(" testOtter" ).get().output.classesDirs
121- classpath = sourceSets.named(" testOtter" ).get().runtimeClasspath
122-
123- // Disable all parallelism
124- systemProperty(" junit.jupiter.execution.parallel.enabled" , false )
125- systemProperty(
126- " junit.jupiter.testclass.order.default" ,
127- " org.junit.jupiter.api.ClassOrderer\$ OrderAnnotation" ,
128- )
129-
130- // Tell our launcher to target a testcontainer-based network
131- systemProperty(" otter.env" , " container" )
132-
133- // Limit heap and number of processors
134- maxHeapSize = " 8g"
135- jvmArgs(" -XX:ActiveProcessorCount=6" )
136- }
137-
138- // Configure the default testIntegration task with proper memory settings
139- tasks.testIntegration {
140- useJUnitPlatform()
141- testClassesDirs = sourceSets.testIntegration.get().output.classesDirs
142- classpath = sourceSets.testIntegration.get().runtimeClasspath
143-
144- // Disable all parallelism
145- systemProperty(" junit.jupiter.execution.parallel.enabled" , false )
146- systemProperty(
147- " junit.jupiter.testclass.order.default" ,
148- " org.junit.jupiter.api.ClassOrderer\$ OrderAnnotation" ,
149- )
150-
151- // Limit heap and number of processors
152- maxHeapSize = " 8g"
153- jvmArgs(" -XX:ActiveProcessorCount=6" )
154- }
0 commit comments