11@Library (' shared-libraries' ) _
22
3- def runTests () {
4- sh label : ' deploy-test-app-and-run-tests' , script : '''
5- export JAVA_HOME=$JAVA_HOME_DIR
6- export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
7- export PATH=$JAVA_HOME/bin:${NODE_HOME_DIR}/bin:$PATH
3+ def runTests (excludeFragileTests ) {
4+ def excludeFlag = excludeFragileTests ? ' --exclude "test-basic/documents-data-movement-*.js"' : ' '
5+
6+ sh label : ' deploy-test-app-and-run-tests' , script : """
7+ export JAVA_HOME=\$ JAVA_HOME_DIR
8+ export GRADLE_USER_HOME=\$ WORKSPACE/\$ GRADLE_DIR
9+ export PATH=\$ JAVA_HOME/bin:\$ {NODE_HOME_DIR}/bin:\$ PATH
810 cd node-client-api
911 node --version
1012 npm --version
1113 npm ci
1214
1315 cd test-app
1416 ./gradlew -i mlWaitTillReady
15- sleep 3
16- ./gradlew -i mlWaitTillReady
1717 ./gradlew -i mlTestConnections
1818 ./gradlew -i mlDeploy
1919 ./gradlew -i -Penv=e2e mlLoadData mlLoadModules
2020
2121 cd ..
22- rm -rf $WORKSPACE/*.xml || true
23- ./node_modules/.bin/mocha --timeout 10000 -R xunit test-basic/ --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/test-basic-reports.xml || true
22+ rm -rf \ $ WORKSPACE/*.xml || true
23+ ./node_modules/.bin/mocha --timeout 10000 -R xunit test-basic/ ${ excludeFlag } --reporter mocha-junit-reporter --reporter-options mochaFile=\ $ WORKSPACE/test-basic-reports.xml || true
2424 ./node_modules/.bin/gulp setupProxyTests || true
25- ./node_modules/.bin/mocha --timeout 10000 -R xunit test-basic-proxy/lib/**/*.js --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/test-basic-proxy-reports.xml || true
26- '''
25+ ./node_modules/.bin/mocha --timeout 10000 -R xunit test-basic-proxy/lib/**/*.js --reporter mocha-junit-reporter --reporter-options mochaFile=\ $ WORKSPACE/test-basic-proxy-reports.xml || true
26+ """
2727 junit ' **/*.xml'
2828}
2929
@@ -55,7 +55,7 @@ def runAuditReport() {
5555 cd node-client-api
5656 npm ci
5757 rm -rf $WORKSPACE/npm-audit-report.json || true
58- npm audit --audit-level=low --json > $WORKSPACE/npm-audit-report.json
58+ npm audit --audit-level=moderate --json > $WORKSPACE/npm-audit-report.json
5959 '''
6060}
6161
@@ -69,16 +69,38 @@ def runLint() {
6969 '''
7070}
7171
72- def runE2ETests () {
73- sh label : ' run-e2e-tests' , script : '''
72+ def runTypeCheck () {
73+ sh label : ' run-type-check' , script : '''
74+ export PATH=${NODE_HOME_DIR}/bin:$PATH
75+ cd node-client-api
76+ npm ci
77+ npm run test:types
78+ '''
79+ }
80+
81+ def runTypeScriptTests () {
82+ sh label : ' run-typescript-tests' , script : '''
7483 export PATH=${NODE_HOME_DIR}/bin:$PATH
84+ cd node-client-api
85+ npm ci
86+ npm run test:compile
87+ ./node_modules/.bin/mocha --timeout 10000 test-typescript/*.js --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/test-typescript-reports.xml || true
88+ '''
89+ junit ' **/*test-typescript-reports.xml'
90+ }
91+
92+ def runE2ETests (excludeFragileTests ) {
93+ def excludeFlag = excludeFragileTests ? ' --exclude "test-complete/nodejs-dmsdk*.js"' : ' '
94+
95+ sh label : ' run-e2e-tests' , script : """
96+ export PATH=\$ {NODE_HOME_DIR}/bin:\$ PATH
7597 cd node-client-api
7698 node --version
7799 npm --version
78100 npm ci
79101
80102 echo "Running test-complete tests"
81- ./node_modules/.bin/mocha --no-parallel -R xunit --timeout 60000 test-complete/ --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/test-complete-results.xml || true
103+ ./node_modules/.bin/mocha --no-parallel -R xunit --timeout 60000 test-complete/ ${ excludeFlag } --reporter mocha-junit-reporter --reporter-options mochaFile=\ $ WORKSPACE/test-complete-results.xml || true
82104 echo "Done with test-complete tests"
83105
84106 cd test-complete-proxy
@@ -90,12 +112,12 @@ def runE2ETests() {
90112 cp -R ml-modules/ ../test-complete
91113 cd ../test-complete
92114 ../node_modules/.bin/mocha -R xunit --timeout 20000 nodejs-ds-setup-docs.js
93- ../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-required-params.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-required-params-results.xml || true
94- ../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-error-map.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-multipleWorker-results.xml || true
95- ../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-multipleWorker.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-multipleWorker-results.xml || true
96- ../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-transactions.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-transactions-results.js.xml || true
97- ../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-dynamic.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-dynamic-results.xml || true
98- '''
115+ ../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-required-params.js" --reporter mocha-junit-reporter --reporter-options mochaFile=\ $ WORKSPACE/ds-required-params-results.xml || true
116+ ../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-error-map.js" --reporter mocha-junit-reporter --reporter-options mochaFile=\ $ WORKSPACE/ds-multipleWorker-results.xml || true
117+ ../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-multipleWorker.js" --reporter mocha-junit-reporter --reporter-options mochaFile=\ $ WORKSPACE/ds-multipleWorker-results.xml || true
118+ ../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-transactions.js" --reporter mocha-junit-reporter --reporter-options mochaFile=\ $ WORKSPACE/ds-transactions-results.js.xml || true
119+ ../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-dynamic.js" --reporter mocha-junit-reporter --reporter-options mochaFile=\ $ WORKSPACE/ds-dynamic-results.xml || true
120+ """
99121 junit ' **/*.xml'
100122}
101123
@@ -108,6 +130,7 @@ pipeline {
108130
109131 parameters {
110132 booleanParam(name : ' regressions' , defaultValue : false , description : ' indicator if build is for regressions' )
133+ string(name : ' MARKLOGIC_IMAGE_TAGS' , defaultValue : ' marklogic-server-ubi:latest-11,marklogic-server-ubi:latest-12' , description : ' Comma-delimited list of MarkLogic image tags including variant (e.g., marklogic-server-ubi:latest-11,marklogic-server-ubi-rootless:11.3.2). The registry/org (ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic) path will be prepended automatically.' )
111134 }
112135
113136 options {
@@ -130,9 +153,11 @@ pipeline {
130153 steps {
131154 runAuditReport()
132155 runLint()
156+ runTypeCheck()
133157 runDockerCompose(' ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-12' )
134- runTests()
135- runE2ETests()
158+ runTests(true )
159+ runTypeScriptTests()
160+ runE2ETests(true )
136161 }
137162 post {
138163 always {
@@ -142,63 +167,27 @@ pipeline {
142167 }
143168
144169 stage(' regressions' ) {
145- parallel {
146-
147- stage(' runtests-11-nightly' ) {
148- when {
149- allOf {
150- branch ' develop'
151- expression { return params. regressions }
152- }
153- }
154- agent { label ' nodeclientpool' }
155- steps {
156- runDockerCompose(' ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-11' )
157- runTests()
158- runE2ETests()
159- }
160- post {
161- always {
162- teardownAfterTests()
163- }
164- }
165- }
166-
167- stage(' runtests-12-nightly' ) {
168- when {
169- allOf {
170- branch ' develop'
171- expression { return params. regressions }
172- }
173- }
174- agent { label ' nodeclientpool' }
175- steps {
176- runDockerCompose(' ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-12' )
177- runTests()
178- runE2ETests()
179- }
180- post {
181- always {
182- teardownAfterTests()
183- }
184- }
170+ agent { label ' nodeclientpool' }
171+ when {
172+ allOf {
173+ branch ' develop'
174+ expression { return params. regressions }
185175 }
186-
187- stage(' runtests-10-nightly' ) {
188- when {
189- allOf {
190- branch ' develop'
191- expression { return params. regressions }
192- }
193- }
194- agent { label ' nodeclientpool' }
195- steps {
196- runDockerCompose(' ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-10' )
197- runTests()
198- runE2ETests()
199- }
200- post {
201- always {
176+ }
177+ steps {
178+ script {
179+ def imageTags = params. MARKLOGIC_IMAGE_TAGS . split(' ,' )
180+ def imagePrefix = ' ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/'
181+
182+ imageTags. each { tag ->
183+ def fullImage = imagePrefix + tag. trim()
184+
185+ try {
186+ runDockerCompose(fullImage)
187+ runTests(false )
188+ runTypeScriptTests()
189+ runE2ETests(false )
190+ } finally {
202191 teardownAfterTests()
203192 }
204193 }
0 commit comments