diff --git a/.agents/references/testing-guide.md b/.agents/references/testing-guide.md index a7b5c128a2..4140bfc6e3 100644 --- a/.agents/references/testing-guide.md +++ b/.agents/references/testing-guide.md @@ -50,6 +50,9 @@ description: Testing frameworks, conventions, and commands for the MongoDB Java # Scala tests (all versions) ./gradlew scalaCheck + +# Custom test JVM heap size (default: 4g) +./gradlew :driver-core:test -PtestMaxHeapSize=1g ``` ## Module-Specific Notes diff --git a/.evergreen/run-fle-on-demand-credential-test.sh b/.evergreen/run-fle-on-demand-credential-test.sh index 6445b53c66..2a45db4d50 100755 --- a/.evergreen/run-fle-on-demand-credential-test.sh +++ b/.evergreen/run-fle-on-demand-credential-test.sh @@ -20,6 +20,11 @@ if ! which java ; then sudo apt install openjdk-17-jdk -y fi +if ! which gpg ; then + echo "Installing gpg..." + sudo apt install gnupg -y +fi + export PROVIDER=${PROVIDER} echo "Running gradle version" diff --git a/.evergreen/run-mongodb-aws-ecs-test.sh b/.evergreen/run-mongodb-aws-ecs-test.sh index 63e4232839..eee2999813 100755 --- a/.evergreen/run-mongodb-aws-ecs-test.sh +++ b/.evergreen/run-mongodb-aws-ecs-test.sh @@ -36,6 +36,11 @@ if ! which git ; then apt install git -y fi +if ! which gpg ; then + echo "Installing gpg..." + sudo apt install gnupg -y +fi + cd src RELATIVE_DIR_PATH="$(dirname "${BASH_SOURCE:-$0}")" diff --git a/.evergreen/run-mongodb-oidc-test.sh b/.evergreen/run-mongodb-oidc-test.sh index 778b8962c0..e96f05a6f4 100755 --- a/.evergreen/run-mongodb-oidc-test.sh +++ b/.evergreen/run-mongodb-oidc-test.sh @@ -41,6 +41,11 @@ if ! which java ; then echo "Installed java." fi +if ! which gpg ; then + echo "Installing gpg..." + sudo apt install gnupg -y +fi + which java export OIDC_TESTS_ENABLED=true @@ -49,18 +54,21 @@ TO_REPLACE="mongodb://" REPLACEMENT="mongodb://$OIDC_ADMIN_USER:$OIDC_ADMIN_PWD@" ADMIN_URI=${MONGODB_URI/$TO_REPLACE/$REPLACEMENT} +# Limit memory for the containers +GRADLE_EXTRA_VARS="--no-daemon -Dorg.gradle.jvmargs=-Xmx512m -PtestMaxHeapSize=1g" + echo "Running gradle version" -./gradlew -version +./gradlew $GRADLE_EXTRA_VARS -version echo "Running gradle classes compile for driver-sync and driver-reactive-streams: ${FULL_DESCRIPTION}" -./gradlew --parallel --stacktrace --info \ +./gradlew $GRADLE_EXTRA_VARS --parallel --stacktrace --info \ driver-sync:classes driver-reactive-streams:classes echo "Running OIDC authentication tests against driver-sync: ${FULL_DESCRIPTION}" -./gradlew -Dorg.mongodb.test.uri="$ADMIN_URI" \ +./gradlew $GRADLE_EXTRA_VARS -Dorg.mongodb.test.uri="$ADMIN_URI" \ --stacktrace --debug --info \ driver-sync:test --tests OidcAuthenticationProseTests --tests UnifiedAuthTest echo "Running OIDC authentication tests against driver-reactive-streams: ${FULL_DESCRIPTION}" -./gradlew -Dorg.mongodb.test.uri="$ADMIN_URI" \ +./gradlew $GRADLE_EXTRA_VARS -Dorg.mongodb.test.uri="$ADMIN_URI" \ --stacktrace --debug --info driver-reactive-streams:test --tests OidcAuthenticationAsyncProseTests diff --git a/.gitignore b/.gitignore index 8cc6afec7d..02e9bdf0e2 100644 --- a/.gitignore +++ b/.gitignore @@ -59,8 +59,12 @@ local.properties # per-developer Agent overrides .AGENTS.md .claude/settings.local.json +.claude/docs CLAUDE.local.md +# Eclipse annotation processing +driver-benchmarks/.factorypath + # bin build directories **/bin diff --git a/buildSrc/src/main/kotlin/conventions/testing-base.gradle.kts b/buildSrc/src/main/kotlin/conventions/testing-base.gradle.kts index 4708c742d4..e368bab0a6 100644 --- a/buildSrc/src/main/kotlin/conventions/testing-base.gradle.kts +++ b/buildSrc/src/main/kotlin/conventions/testing-base.gradle.kts @@ -29,7 +29,8 @@ plugins { } tasks.withType { - maxHeapSize = "4g" + // Override with -PtestMaxHeapSize= (e.g. "1g", "512m"). Defaults to 4g. + maxHeapSize = findProperty("testMaxHeapSize")?.toString() ?: "4g" maxParallelForks = 1 useJUnitPlatform()