Skip to content

Commit

Permalink
[ANCHOR-692] Disable JUnit test parallel execution (#1357)
Browse files Browse the repository at this point in the history
### Description

Disable the Junit concurrency for test stability reason. 

### Context

The tests had been unstable due to the concurrency that fails some of
the tests.

### Testing

- `./gradlew test`
- The workflow is successful for 5 consecutive runs.

### Documentation
NA.

### Known limitations
NA.
  • Loading branch information
lijamie98 committed May 14, 2024
1 parent dbb5ff6 commit 0fc46d0
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 48 deletions.
4 changes: 0 additions & 4 deletions api-schema/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,4 @@ dependencies {
annotationProcessor(libs.lombok)
}

apply(from = "$rootDir/scripts.gradle.kts")
@Suppress("UNCHECKED_CAST")
val enableTestConcurrency = extra["enableTestConcurrency"] as (Test) -> Unit

tasks.test { enableTestConcurrency(this) }
9 changes: 1 addition & 8 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,4 @@ publishing {

apply<SigningPlugin>()
configure<SigningExtension> { sign(publishing.publications) }
}

apply(from = "$rootDir/scripts.gradle.kts")

@Suppress("UNCHECKED_CAST")
val enableTestConcurrency = extra["enableTestConcurrency"] as (Test) -> Unit

tasks.test { enableTestConcurrency(this) }
}
6 changes: 0 additions & 6 deletions essential-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,7 @@ dependencies {

tasks { bootJar { enabled = false } }

// The following is to enable test concurrency
apply(from = "$rootDir/scripts.gradle.kts")
@Suppress("UNCHECKED_CAST")
val enableTestConcurrency = extra["enableTestConcurrency"] as (Test) -> Unit

tasks.test {
enableTestConcurrency(this)
exclude("**/org/stellar/anchor/platform/*Test.class")
exclude("**/org/stellar/anchor/platform/integrationtest/**")
exclude("**/org/stellar/anchor/platform/e2etest/**")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.Arguments
import org.junit.jupiter.params.provider.MethodSource
Expand Down Expand Up @@ -52,7 +50,6 @@ const val DEPOSIT_FUND_CLIENT_SECRET_1 = "SDNZAK6LCYNR4HYEFBZY3I2KLRDLSCE5RCF6HZ
const val DEPOSIT_FUND_CLIENT_SECRET_2 = "SCW2SJEPTL4K7FFPFOFABFEFZJCG6LHULWVJX6JLIJ7TYIKTL6P473HM"

@TestInstance(PER_CLASS)
@Execution(CONCURRENT)
open class Sep24End2EndTests : AbstractIntegrationTests(TestConfig()) {
private val client = HttpClient {
install(HttpTimeout) {
Expand All @@ -61,7 +58,7 @@ open class Sep24End2EndTests : AbstractIntegrationTests(TestConfig()) {
socketTimeoutMillis = 300000
}
}
private val maxTries = 30
private val maxTries = 60
private val anchorReferenceServerClient =
AnchorReferenceServerClient(Url(config.env["reference.server.url"]!!))
private val walletServerClient = WalletServerClient(Url(config.env["wallet.server.url"]!!))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.fail
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode
import org.stellar.anchor.api.callback.SendEventRequest
import org.stellar.anchor.api.callback.SendEventRequestPayload
import org.stellar.anchor.api.event.AnchorEvent
Expand Down Expand Up @@ -42,7 +40,6 @@ import org.stellar.walletsdk.horizon.SigningKeyPair
import org.stellar.walletsdk.horizon.sign

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Execution(ExecutionMode.CONCURRENT)
open class Sep31End2EndTests : AbstractIntegrationTests(TestConfig()) {

private val gson = GsonUtils.getInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode
import org.stellar.anchor.api.sep.SepTransactionStatus
import org.stellar.anchor.api.sep.SepTransactionStatus.*
import org.stellar.anchor.api.sep.sep6.GetTransactionResponse
Expand All @@ -28,7 +26,6 @@ import org.stellar.walletsdk.asset.IssuedAssetId
import org.stellar.walletsdk.horizon.sign

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Execution(ExecutionMode.CONCURRENT)
open class Sep6End2EndTest : AbstractIntegrationTests(TestConfig()) {
private val maxTries = 30
private val anchorReferenceServerClient =
Expand Down
6 changes: 0 additions & 6 deletions extended-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,4 @@ dependencies {

tasks { bootJar { enabled = false } }

// The following is to enable test concurrency
apply(from = "$rootDir/scripts.gradle.kts")

@Suppress("UNCHECKED_CAST")
val enableTestConcurrency = extra["enableTestConcurrency"] as (Test) -> Unit

tasks.test { exclude("**/org/stellar/anchor/platform/extendedtest/**") }
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
package org.stellar.anchor.platform.extendedtest.rpc

import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode
import org.stellar.anchor.api.event.AnchorEvent
import org.stellar.anchor.api.sep.SepTransactionStatus
import org.stellar.anchor.platform.e2etest.Sep24End2EndTests
import org.stellar.anchor.platform.e2etest.Sep31End2EndTests
import org.stellar.anchor.platform.e2etest.Sep6End2EndTest

// use TEST_PROFILE_NAME = "rpc"
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Execution(ExecutionMode.SAME_THREAD)
class CustodyRpcSep31End2EndTests : Sep31End2EndTests()

// use TEST_PROFILE_NAME = "rpc"
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Execution(ExecutionMode.SAME_THREAD)
class CustodyRpcSep24End2EndTests : Sep24End2EndTests() {
// These are to override the default expected statuses for RPC configuration
override fun getExpectedDepositStatus(): List<Pair<AnchorEvent.Type, SepTransactionStatus>> {
Expand All @@ -41,6 +34,4 @@ class CustodyRpcSep24End2EndTests : Sep24End2EndTests() {
}

// use TEST_PROFILE_NAME = "rpc"
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Execution(ExecutionMode.SAME_THREAD)
class CustodyRpcSep6End2EndTests : Sep6End2EndTest()
5 changes: 0 additions & 5 deletions platform/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,7 @@ dependencies {
testImplementation(libs.okhttp3.tls)
}

apply(from = "$rootDir/scripts.gradle.kts")
@Suppress("UNCHECKED_CAST")
val enableTestConcurrency = extra["enableTestConcurrency"] as (Test) -> Unit

tasks.test {
enableTestConcurrency(this)
testLogging {
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
events = setOf(org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED)
Expand Down

0 comments on commit 0fc46d0

Please sign in to comment.