-
Notifications
You must be signed in to change notification settings - Fork 181
build: streamline test setup in otter modules #21953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+125
−177
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0529e78
build: streamline test setup in otter modules
jjohannes 5c19298
chore: move integration tests into a dedicated package
jjohannes 5d20baf
build: introduce testIntegration/java/module-info.java
jjohannes 5e81aad
build: use 0.6.1 version of plugins
jjohannes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
platform-sdk/consensus-otter-docker-app/src/main/java/module-info.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,158 +1,64 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| import org.gradlex.javamodule.dependencies.dsl.GradleOnlyDirectives | ||
|
|
||
| plugins { | ||
| id("java-library") | ||
| id("jacoco") | ||
| id("org.hiero.gradle.base.jpms-modules") | ||
| id("org.hiero.gradle.base.lifecycle") | ||
| id("org.hiero.gradle.base.version") | ||
| id("org.hiero.gradle.check.dependencies") | ||
| id("org.hiero.gradle.check.javac-lint") | ||
| id("org.hiero.gradle.check.spotless") | ||
| id("org.hiero.gradle.check.spotless-java") | ||
| id("org.hiero.gradle.check.spotless-kotlin") | ||
| id("org.hiero.gradle.feature.git-properties-file") | ||
| id("org.hiero.gradle.feature.java-compile") | ||
| id("org.hiero.gradle.feature.java-execute") | ||
| id("org.hiero.gradle.feature.test") | ||
| id("org.hiero.gradle.report.test-logger") | ||
| id("org.hiero.gradle.module.library") | ||
| id("org.hiero.gradle.feature.test-fixtures") | ||
| id("org.hiero.gradle.feature.test-integration") | ||
| id("org.hiero.gradle.feature.protobuf") | ||
| } | ||
|
|
||
| description = "Consensus Otter Test Framework" | ||
|
|
||
| @Suppress("UnstableApiUsage") | ||
| testing { | ||
| suites.named<JvmTestSuite>("test") { | ||
| javaModuleTesting.whitebox(this) { sourcesUnderTest = sourceSets.testFixtures } | ||
| } | ||
|
|
||
| suites.named<JvmTestSuite>("testIntegration") { | ||
| targets.configureEach { testTask { dependsOn(":consensus-otter-docker-app:assemble") } } | ||
| } | ||
|
|
||
| suites.register<JvmTestSuite>("testOtter") { | ||
| // Runs tests against the Container environment | ||
| targets.register("testContainer") { testTask { systemProperty("otter.env", "container") } } | ||
|
|
||
| // Runs tests against the Turtle environment | ||
| targets.register("testTurtle") { testTask { systemProperty("otter.env", "turtle") } } | ||
|
|
||
| targets.configureEach { testTask { dependsOn(":consensus-otter-docker-app:assemble") } } | ||
| } | ||
| } | ||
|
|
||
| testModuleInfo { | ||
| requires("com.swirlds.base") | ||
| requires("com.swirlds.base.test.fixtures") | ||
| requires("com.swirlds.common.test.fixtures") | ||
| requires("com.swirlds.component.framework") | ||
| requires("com.swirlds.metrics.api") | ||
| requires("com.swirlds.platform.core.test.fixtures") | ||
| requires("org.hiero.otter.fixtures") | ||
| requires("org.apache.logging.log4j") | ||
| requires("org.assertj.core") | ||
| requires("org.hiero.consensus.utility") | ||
| requires("org.junit.jupiter.params") | ||
| requires("org.mockito") | ||
| requires("com.github.spotbugs.annotations") | ||
| requires("com.swirlds.component.framework") | ||
| requires("com.swirlds.metrics.api") | ||
| requires("org.hiero.consensus.utility") | ||
| requires("org.apache.logging.log4j") | ||
| requiresStatic("com.github.spotbugs.annotations") | ||
| } | ||
|
|
||
| testing.suites { | ||
| val testOtter by | ||
| registering(JvmTestSuite::class) { | ||
| useJUnitJupiter() | ||
|
|
||
| dependencies { | ||
| implementation(project()) | ||
| implementation(project.dependencies.testFixtures(project())) | ||
| implementation(project(":swirlds-common")) | ||
| implementation(project(":swirlds-platform-core")) | ||
| implementation(project(":base-crypto")) | ||
| implementation("org.junit.jupiter:junit-jupiter-params") | ||
| implementation("com.github.spotbugs:spotbugs-annotations") | ||
| runtimeOnly("io.grpc:grpc-netty-shaded") | ||
| } | ||
|
|
||
| targets { | ||
| all { | ||
| testTask.configure { | ||
| dependsOn(":consensus-otter-docker-app:assemble") | ||
|
|
||
| // Disable all parallelism | ||
| systemProperty("junit.jupiter.execution.parallel.enabled", false) | ||
| systemProperty( | ||
| "junit.jupiter.testclass.order.default", | ||
| "org.junit.jupiter.api.ClassOrderer\$OrderAnnotation", | ||
| ) | ||
|
|
||
| // Limit heap and number of processors | ||
| maxHeapSize = "8g" | ||
| jvmArgs("-XX:ActiveProcessorCount=6") | ||
| } | ||
| } | ||
| } | ||
| } | ||
| testIntegrationModuleInfo { // | ||
| runtimeOnly("io.grpc.netty.shaded") | ||
| } | ||
|
|
||
| testIntegrationModuleInfo { | ||
| requires("com.swirlds.common.test.fixtures") | ||
| requires("com.swirlds.logging") | ||
| requires("org.hiero.otter.fixtures") | ||
| requires("org.assertj.core") | ||
| requires("org.junit.jupiter.params") | ||
| requires("com.github.spotbugs.annotations") | ||
| requires("org.apache.logging.log4j") | ||
| requires("awaitility") | ||
| extensions.getByName<GradleOnlyDirectives>("testOtterModuleInfo").apply { | ||
| runtimeOnly("io.grpc.netty.shaded") | ||
| } | ||
|
|
||
| tasks.withType<Test>().configureEach { maxHeapSize = "8g" } | ||
|
|
||
| // This should probably not be necessary (Log4j issue?) | ||
| // https://github.com/apache/logging-log4j2/pull/3053 | ||
| tasks.compileTestFixturesJava { | ||
| options.compilerArgs.add("-Alog4j.graalvm.groupId=${project.group}") | ||
| options.compilerArgs.add("-Alog4j.graalvm.artifactId=${project.name}") | ||
| } | ||
|
|
||
| // Runs tests against the Turtle environment | ||
| tasks.register<Test>("testTurtle") { | ||
| useJUnitPlatform() | ||
| testClassesDirs = sourceSets.named("testOtter").get().output.classesDirs | ||
| classpath = sourceSets.named("testOtter").get().runtimeClasspath | ||
|
|
||
| // Disable all parallelism | ||
| systemProperty("junit.jupiter.execution.parallel.enabled", false) | ||
| systemProperty( | ||
| "junit.jupiter.testclass.order.default", | ||
| "org.junit.jupiter.api.ClassOrderer\$OrderAnnotation", | ||
| ) | ||
| // Tell our launcher to target a Turtle network | ||
| systemProperty("otter.env", "turtle") | ||
|
|
||
| // Limit heap and number of processors | ||
| maxHeapSize = "8g" | ||
| jvmArgs("-XX:ActiveProcessorCount=6") | ||
| } | ||
|
|
||
| // Runs tests against the Container environment | ||
| tasks.register<Test>("testContainer") { | ||
| dependsOn(":consensus-otter-docker-app:assemble") | ||
|
|
||
| useJUnitPlatform() | ||
| testClassesDirs = sourceSets.named("testOtter").get().output.classesDirs | ||
| classpath = sourceSets.named("testOtter").get().runtimeClasspath | ||
|
|
||
| // Disable all parallelism | ||
| systemProperty("junit.jupiter.execution.parallel.enabled", false) | ||
| systemProperty( | ||
| "junit.jupiter.testclass.order.default", | ||
| "org.junit.jupiter.api.ClassOrderer\$OrderAnnotation", | ||
| ) | ||
|
|
||
| // Tell our launcher to target a testcontainer-based network | ||
| systemProperty("otter.env", "container") | ||
|
|
||
| // Limit heap and number of processors | ||
| maxHeapSize = "8g" | ||
| jvmArgs("-XX:ActiveProcessorCount=6") | ||
| } | ||
|
|
||
| // Configure the default testIntegration task with proper memory settings | ||
| tasks.testIntegration { | ||
| dependsOn(":consensus-otter-docker-app:assemble") | ||
|
|
||
| useJUnitPlatform() | ||
| testClassesDirs = sourceSets.testIntegration.get().output.classesDirs | ||
| classpath = sourceSets.testIntegration.get().runtimeClasspath | ||
|
|
||
| // Disable all parallelism | ||
| systemProperty("junit.jupiter.execution.parallel.enabled", false) | ||
| systemProperty( | ||
| "junit.jupiter.testclass.order.default", | ||
| "org.junit.jupiter.api.ClassOrderer\$OrderAnnotation", | ||
| ) | ||
|
|
||
| // Limit heap and number of processors | ||
| maxHeapSize = "8g" | ||
| jvmArgs("-XX:ActiveProcessorCount=6") | ||
| } |
2 changes: 0 additions & 2 deletions
2
platform-sdk/consensus-otter-tests/src/main/java/module-info.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
platform-sdk/consensus-otter-tests/src/testIntegration/java/module-info.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| open module org.hiero.otter.fixtures.test { | ||
| requires com.swirlds.common.test.fixtures; | ||
| requires com.swirlds.logging; | ||
| requires org.hiero.otter.fixtures; | ||
| requires awaitility; | ||
| requires org.apache.logging.log4j; | ||
| requires org.assertj.core; | ||
| requires org.junit.jupiter.params; | ||
| requires static com.github.spotbugs.annotations; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
...ero/otter/fixtures/NodeLifecycleTest.java → ...tter/fixtures/test/NodeLifecycleTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
.../hiero/otter/fixtures/NodeWeightTest.java → ...o/otter/fixtures/test/NodeWeightTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.