From 0f476c9eb34e2488097f77b999ff2cb239ad9691 Mon Sep 17 00:00:00 2001 From: Rob Rudin Date: Wed, 1 Oct 2025 10:34:30 -0400 Subject: [PATCH] MLE-24505 Configuring custom Test tasks correctly This avoids Gradle warnings and also gets the reverse proxy server tests working properly again. Also disabling the reverse proxy tests, as those apparently were not hitting the reverse proxy before due to a Gradle misconfiguration that this PR fixes. Opened MLE-24523 to fix those later. --- Jenkinsfile | 40 ++++++++++--------- build.gradle | 14 ++++--- .../build.gradle | 25 +++++++----- marklogic-client-api/build.gradle | 9 +++-- 4 files changed, 48 insertions(+), 40 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index aca93c979..73ddfdf1b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -173,8 +173,9 @@ pipeline{ export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH cd java-client-api ./gradlew cleanTest marklogic-client-api:test - ./gradlew -PtestUseReverseProxyServer=true test-app:runReverseProxyServer marklogic-client-api-functionaltests:runFastFunctionalTests || true ''' + // Omitting this until MLE-24523 can be addressed + // ./gradlew -PtestUseReverseProxyServer=true test-app:runReverseProxyServer marklogic-client-api-functionaltests:runFastFunctionalTests || true junit '**/build/**/TEST*.xml' } post { @@ -222,24 +223,25 @@ pipeline{ } } - stage('regressions-11-reverseProxy') { - when { - allOf { - branch 'develop' - expression {return params.regressions} - } - } - steps { - runTestsWithReverseProxy("ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-11") - junit '**/build/**/TEST*.xml' - } - post { - always { - updateWorkspacePermissions() - tearDownDocker() - } - } - } + // Omitting this until MLE-24523 can be addressed +// stage('regressions-11-reverseProxy') { +// when { +// allOf { +// branch 'develop' +// expression {return params.regressions} +// } +// } +// steps { +// runTestsWithReverseProxy("ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-11") +// junit '**/build/**/TEST*.xml' +// } +// post { +// always { +// updateWorkspacePermissions() +// tearDownDocker() +// } +// } +// } stage('regressions-12') { when { diff --git a/build.gradle b/build.gradle index 89d038dbd..a87d5146e 100644 --- a/build.gradle +++ b/build.gradle @@ -5,11 +5,6 @@ subprojects { apply plugin: 'java-library' - tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' - options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation"] - } - java { toolchain { languageVersion = JavaLanguageVersion.of(17) @@ -32,12 +27,19 @@ subprojects { mavenCentral() } - test { + tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' + options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation"] + } + + tasks.withType(Test).configureEach { useJUnitPlatform() testLogging { events = ['started', 'passed', 'skipped', 'failed'] exceptionFormat = 'full' } + + // Will remove this in a future PR to determine if they're needed or not. systemProperty "file.encoding", "UTF-8" systemProperty "javax.xml.stream.XMLOutputFactory", "com.sun.xml.internal.stream.XMLOutputFactoryImpl" } diff --git a/marklogic-client-api-functionaltests/build.gradle b/marklogic-client-api-functionaltests/build.gradle index cc78be9d8..a40f43f59 100755 --- a/marklogic-client-api-functionaltests/build.gradle +++ b/marklogic-client-api-functionaltests/build.gradle @@ -2,14 +2,6 @@ * Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. */ -test { - // For use in testing TestDatabaseClientKerberosFromFile - systemProperty "keytabFile", System.getProperty("keytabFile") - systemProperty "principal", System.getProperty("principal") - - systemProperty "TEST_USE_REVERSE_PROXY_SERVER", testUseReverseProxyServer -} - dependencies { testImplementation project(':marklogic-client-api') testImplementation "jakarta.xml.bind:jakarta.xml.bind-api:4.0.4" @@ -37,20 +29,30 @@ dependencies { testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.13.4" } +tasks.withType(Test).configureEach { + // For use in testing TestDatabaseClientKerberosFromFile + systemProperty "keytabFile", System.getProperty("keytabFile") + systemProperty "principal", System.getProperty("principal") + + systemProperty "TEST_USE_REVERSE_PROXY_SERVER", testUseReverseProxyServer +} + tasks.register("runFragileTests", Test) { - useJUnitPlatform() description = "These are called 'fragile' because they'll pass when run by themselves, but when run as part of the " + "full suite, there seem to be one or more other fast functional tests that run before them and cause some of " + "their test methods to break. The Jenkinsfile thus calls these first before running the other functional " + "tests." + testClassesDirs = sourceSets.test.output.classesDirs + classpath = sourceSets.test.runtimeClasspath include "com/marklogic/client/fastfunctest/TestQueryOptionBuilder.class" include "com/marklogic/client/fastfunctest/TestRawCombinedQuery.class" include "com/marklogic/client/fastfunctest/TestRawStructuredQuery.class" } tasks.register("runFastFunctionalTests", Test) { - useJUnitPlatform() description = "Run all fast functional tests that don't setup/teardown custom app servers / databases" + testClassesDirs = sourceSets.test.output.classesDirs + classpath = sourceSets.test.runtimeClasspath include "com/marklogic/client/fastfunctest/**" // Exclude the "fragile" ones exclude "com/marklogic/client/fastfunctest/TestQueryOptionBuilder.class" @@ -59,8 +61,9 @@ tasks.register("runFastFunctionalTests", Test) { } tasks.register("runSlowFunctionalTests", Test) { - useJUnitPlatform() description = "Run slow functional tests; i.e. those that setup/teardown custom app servers / databases" + testClassesDirs = sourceSets.test.output.classesDirs + classpath = sourceSets.test.runtimeClasspath include "com/marklogic/client/datamovement/functionaltests/**" include "com/marklogic/client/functionaltest/**" } diff --git a/marklogic-client-api/build.gradle b/marklogic-client-api/build.gradle index 40a2a0dc4..47372a6aa 100644 --- a/marklogic-client-api/build.gradle +++ b/marklogic-client-api/build.gradle @@ -77,8 +77,7 @@ dependencies { } // Ensure that mlHost and mlPassword can override the defaults of localhost/admin if they've been modified -test { - useJUnitPlatform() +tasks.withType(Test).configureEach { systemProperty "TEST_HOST", mlHost systemProperty "TEST_ADMIN_PASSWORD", mlPassword // Needed by the tests for the example programs @@ -88,8 +87,9 @@ test { } tasks.register("testRows", Test) { - useJUnitPlatform() description = "Run all 'rows' tests; i.e. those exercising Optic and Optic Update functionality" + testClassesDirs = sourceSets.test.output.classesDirs + classpath = sourceSets.test.runtimeClasspath include "com/marklogic/client/test/rows/**" } @@ -101,8 +101,9 @@ tasks.register("debugCloudAuth", JavaExec) { } tasks.register("runXmlSmokeTests", Test) { - useJUnitPlatform() description = "Run a bunch of XML-related tests for smoke-testing on a particular JVM" + testClassesDirs = sourceSets.test.output.classesDirs + classpath = sourceSets.test.runtimeClasspath include "com/marklogic/client/test/BufferableHandleTest.class" include "com/marklogic/client/test/EvalTest.class" include "com/marklogic/client/test/HandleAsTest.class"