diff --git a/.copyrightconfig b/.copyrightconfig index cf6e131ee..ba242e11f 100644 --- a/.copyrightconfig +++ b/.copyrightconfig @@ -11,4 +11,4 @@ startyear: 2010 # - Dotfiles already skipped automatically # Enable by removing the leading '# ' from the next line and editing values. # filesexcluded: third_party/*, docs/generated/*.md, assets/*.png, scripts/temp_*.py, vendor/lib.js -filesexcluded: .github/*, README.md, Jenkinsfile, gradle/*, docker-compose.yml, *.gradle, gradle.properties, gradlew, gradlew.bat, **/test/resources/**, *.md, pom.xml +filesexcluded: .github/*, README.md, Jenkinsfile, gradle/*, docker-compose.yaml, docker-compose.yml, *.gradle, gradle.properties, gradlew, gradlew.bat, **/test/resources/**, *.md, pom.xml diff --git a/Jenkinsfile b/Jenkinsfile index 76014c05c..f986e4b33 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,6 @@ @Library('shared-libraries') _ -def getJava() { +def getJavaHomePath() { if (env.JAVA_VERSION == "JAVA21") { return "/home/builder/java/jdk-21.0.1" } else { @@ -84,12 +84,21 @@ def runTests(String image) { def runTestsWithReverseProxy(String image) { setupDockerMarkLogic(image) + sh label: 'run marklogic-client-api tests with reverse proxy', script: '''#!/bin/bash + export JAVA_HOME=$JAVA_HOME_DIR + export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR + export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH + cd java-client-api + ./gradlew clean build -x test + ./gradlew -PtestUseReverseProxyServer=true runReverseProxyServer marklogic-client-api:test || true + ''' + sh label: 'run fragile functional tests with reverse proxy', script: '''#!/bin/bash export JAVA_HOME=$JAVA_HOME_DIR export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH cd java-client-api - ./gradlew -PtestUseReverseProxyServer=true test-app:runReverseProxyServer marklogic-client-api-functionaltests:runFragileTests || true + ./gradlew -PtestUseReverseProxyServer=true runReverseProxyServer marklogic-client-api-functionaltests:runFragileTests || true ''' sh label: 'run fast functional tests with reverse proxy', script: '''#!/bin/bash @@ -97,7 +106,7 @@ def runTestsWithReverseProxy(String image) { export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH cd java-client-api - ./gradlew -PtestUseReverseProxyServer=true test-app:runReverseProxyServer marklogic-client-api-functionaltests:runFastFunctionalTests || true + ./gradlew -PtestUseReverseProxyServer=true runReverseProxyServer marklogic-client-api-functionaltests:runFastFunctionalTests || true ''' sh label: 'run slow functional tests with reverse proxy', script: '''#!/bin/bash @@ -105,7 +114,7 @@ def runTestsWithReverseProxy(String image) { export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH cd java-client-api - ./gradlew -PtestUseReverseProxyServer=true test-app:runReverseProxyServer marklogic-client-api-functionaltests:runSlowFunctionalTests || true + ./gradlew -PtestUseReverseProxyServer=true runReverseProxyServer marklogic-client-api-functionaltests:runSlowFunctionalTests || true ''' postProcessTestResults() @@ -149,18 +158,18 @@ pipeline { parameters { booleanParam(name: 'regressions', defaultValue: false, description: 'indicator if build is for regressions') - string(name: 'Email', defaultValue: '', description: 'Who should I say send the email to?') - string(name: 'JAVA_VERSION', defaultValue: 'JAVA8', description: 'Who should I say send the email to?') + string(name: 'JAVA_VERSION', defaultValue: 'JAVA17', description: 'Either JAVA17 or JAVA21') } environment { - JAVA_HOME_DIR = getJava() + JAVA_HOME_DIR = getJavaHomePath() GRADLE_DIR = ".gradle" DMC_USER = credentials('MLBUILD_USER') DMC_PASSWORD = credentials('MLBUILD_PASSWORD') } stages { + stage('pull-request-tests') { when { not { @@ -168,20 +177,23 @@ pipeline { } } steps { - setupDockerMarkLogic("ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi-rootless:11.3.2-ubi-rootless-2.2.2") + setupDockerMarkLogic("ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-12") sh label: 'run marklogic-client-api tests', script: '''#!/bin/bash export JAVA_HOME=$JAVA_HOME_DIR export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH cd java-client-api // Ensure all modules can be built first. - ./gradlew clean build -x test + //./gradlew clean build -x test // Run a sufficient number of tests to verify the PR. - ./gradlew cleanTest marklogic-client-api:test || true + //./gradlew marklogic-client-api:test --tests ReadDocumentPageTest || true + + // Run a test with the reverse proxy server to ensure it's fine. + echo "Starting tests!" + ./gradlew -PtestUseReverseProxyServer=true clean runReverseProxyServer marklogic-client-api:test --tests ReadDocumentPageTest || true + echo "Finished tests!" ''' - // 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 { @@ -218,7 +230,7 @@ pipeline { } } steps { - runTests("ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi-rootless:11.3.2-ubi-rootless-2.2.2") + runTests("ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-11") junit '**/build/**/TEST*.xml' } post { @@ -229,25 +241,24 @@ pipeline { } } - // 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-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-12") + junit '**/build/**/TEST*.xml' + } + post { + always { + updateWorkspacePermissions() + tearDownDocker() + } + } + } stage('regressions-12') { when { @@ -257,7 +268,7 @@ pipeline { } } steps { - runTests("ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi-rootless:12.0.0-ubi-rootless-2.2.0") + runTests("ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-12") junit '**/build/**/TEST*.xml' } post { @@ -268,7 +279,7 @@ pipeline { } } - stage('regressions-10.0') { + stage('regressions-10') { when { allOf { branch 'develop' diff --git a/docker-compose.yaml b/docker-compose.yaml index 569f62b3f..9d1dab27e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -18,10 +18,7 @@ services: - ${MARKLOGIC_LOGS_VOLUME}:/var/opt/MarkLogic/Logs ports: - "8000-8002:8000-8002" - - "8010-8014:8010-8014" - - "8022:8022" - - "8054-8059:8054-8059" - - "8093:8093" + - "8010-8015:8010-8015" # Range of ports used by app servers, at least one of which - 8015 - is created by a test. volumes: marklogicLogs: diff --git a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/fastfunctest/TestDatabaseClientConnection.java b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/fastfunctest/TestDatabaseClientConnection.java index 2f1183a87..22141d798 100644 --- a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/fastfunctest/TestDatabaseClientConnection.java +++ b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/fastfunctest/TestDatabaseClientConnection.java @@ -124,11 +124,10 @@ void invalidPort() { DatabaseClient client = newDatabaseClientBuilder().withPort(assumedInvalidPort).build(); MarkLogicIOException ex = Assertions.assertThrows(MarkLogicIOException.class, () -> client.checkConnection()); - String expected = "Error occurred while calling http://localhost:60123/v1/ping; java.net.ConnectException: " + - "Failed to connect to localhost/127.0.0.1:60123 ; possible reasons for the error include " + + String expected = "Failed to connect to localhost/127.0.0.1:60123 ; possible reasons for the error include " + "that a MarkLogic app server may not be listening on the port, or MarkLogic was stopped " + "or restarted during the request; check the MarkLogic server logs for more information."; - assertEquals(expected, ex.getMessage()); + assertTrue(ex.getMessage().contains(expected), "Unexpected error: " + ex.getMessage()); } @Test diff --git a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/BulkIOCallersFnTest.java b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/BulkIOCallersFnTest.java index 14bc2d6c2..0c8871c6c 100644 --- a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/BulkIOCallersFnTest.java +++ b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/BulkIOCallersFnTest.java @@ -42,7 +42,7 @@ public class BulkIOCallersFnTest extends BasicJavaClientREST { private static String host = null; private static int modulesPort = 8000; - private static int restTestport = 8093; + private static int restTestport = 8015; private static String restServerName = "TestDynamicIngest"; private static SecurityContext secContext = null; diff --git a/test-app/README.md b/test-app/README.md index f397f7b9f..6db548bb7 100644 --- a/test-app/README.md +++ b/test-app/README.md @@ -34,3 +34,8 @@ You can also specify custom mappings via the Gradle task. For example, if you ha port 8123 and you want to associate a path of "/my/custom/server" to it, you can do: ./gradlew runBlock -PrpsCustomMappings=/my/custom/server,8123 + +To run one or more tests with the reverse proxy server being started, the tests being run, and then the server being +stopped, do the following (you can see examples of this in the project `Jenkinsfile` as well): + + ./gradlew -PtestUseReverseProxyServer=true runReverseProxyServer marklogic-client-api:test --tests ReadDocumentPageTest