Skip to content

Commit ce728af

Browse files
committed
MLE-24230 Added wait function
Same approach as in the ragplus project, though waiting for up to 2 minutes. Also echo'ing each request so we can look at the logs afterward in Jenkins to see how long we're typically having to wait.
1 parent ff2f974 commit ce728af

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Jenkinsfile

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ def runDockerCompose(String markLogicDockerImage) {
3333
cd node-client-api
3434
echo "Running docker compose with MarkLogic image: ''' + markLogicDockerImage + '''"
3535
MARKLOGIC_LOGS_VOLUME=/tmp MARKLOGIC_IMAGE=''' + markLogicDockerImage + ''' docker-compose up -d --build
36-
echo "Waiting 90s for MarkLogic to be ready to accept connections"
37-
sleep 90s;
3836
'''
3937
}
4038

@@ -57,6 +55,22 @@ def runAuditReport() {
5755
'''
5856
}
5957

58+
def waitUntilMarkLogicIsReady() {
59+
script {
60+
timeout(time: 120, unit: 'SECONDS') {
61+
waitUntil(initialRecurrencePeriod: 5000) {
62+
try {
63+
sh 'echo "Checking if MarkLogic is ready..."'
64+
sh 'curl -i --anyauth --user admin:admin -X GET http://localhost:8000/v1/ping'
65+
return true
66+
} catch(exception){
67+
return false
68+
}
69+
}
70+
}
71+
}
72+
}
73+
6074
def runE2ETests() {
6175
sh label: 'run-e2e-tests', script: '''
6276
export JAVA_HOME=$JAVA_HOME_DIR
@@ -124,6 +138,7 @@ pipeline {
124138
steps {
125139
runAuditReport()
126140
runDockerCompose('ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-12')
141+
waitUntilMarkLogicIsReady()
127142
runTests()
128143
runE2ETests()
129144
}
@@ -147,6 +162,7 @@ pipeline {
147162
agent { label 'nodeclientpool' }
148163
steps {
149164
runDockerCompose('ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-11')
165+
waitUntilMarkLogicIsReady()
150166
runTests()
151167
runE2ETests()
152168
}
@@ -167,6 +183,7 @@ pipeline {
167183
agent { label 'nodeclientpool' }
168184
steps {
169185
runDockerCompose('ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-12')
186+
waitUntilMarkLogicIsReady()
170187
runTests()
171188
runE2ETests()
172189
}
@@ -187,6 +204,7 @@ pipeline {
187204
agent { label 'nodeclientpool' }
188205
steps {
189206
runDockerCompose('ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-10')
207+
waitUntilMarkLogicIsReady()
190208
runTests()
191209
runE2ETests()
192210
}

0 commit comments

Comments
 (0)