blob: 78a8d6fadda107ad1db6ed14932f10b20aabaac3 [file] [log] [blame]
chnydaf14ea2a2017-05-26 15:07:47 +02001package com.mirantis.mk
2
3/**
Denis Egorenko6fd79ac2018-09-12 13:28:21 +04004 * Setup Docker to run some tests. Returns true/false based on
5 were tests successful or not.
6 * @param config - LinkedHashMap with configuration params:
7 * dockerHostname - (required) Hostname to use for Docker container.
8 * formulasRevision - (optional) Revision of packages to use (default stable).
9 * runCommands - (optional) Dict with closure structure of body required tests. For example:
10 * [ '001_Test': { sh("./run-some-test") }, '002_Test': { sh("./run-another-test") } ]
11 * Before execution runCommands will be sorted by key names. Alpabetical order is preferred.
12 * runFinally - (optional) Dict with closure structure of body required commands, which should be
13 * executed in any case of test results. Same format as for runCommands
14 * updateRepo - (optional) Whether to run common repo update step.
15 * dockerContainerName - (optional) Docker container name.
16 * dockerImageName - (optional) Docker image name
17 * dockerMaxCpus - (optional) Number of CPUS to use in Docker.
18 * dockerExtraOpts - (optional) Array of Docker extra opts for container
19 * envOpts - (optional) Array of variables that should be passed as ENV vars to Docker container.
20 * Return true | false
21 */
22
23def setupDockerAndTest(LinkedHashMap config) {
24 def common = new com.mirantis.mk.Common()
25 def TestMarkerResult = false
26 // setup options
27 def defaultContainerName = 'test-' + UUID.randomUUID().toString()
28 def dockerHostname = config.get('dockerHostname', defaultContainerName)
29 def formulasRevision = config.get('formulasRevision', 'proposed')
30 def runCommands = config.get('runCommands', [:])
31 def runFinally = config.get('runFinally', [:])
32 def baseRepoPreConfig = config.get('baseRepoPreConfig', true)
33 def dockerContainerName = config.get('dockerContainerName', defaultContainerName)
34 def dockerImageName = config.get('image', "mirantis/salt:saltstack-ubuntu-xenial-salt-2017.7")
35 def dockerMaxCpus = config.get('dockerMaxCpus', 4)
36 def dockerExtraOpts = config.get('dockerExtraOpts', [])
37 def envOpts = config.get('envOpts', [])
38 envOpts.add("DISTRIB_REVISION=${formulasRevision}")
39 def dockerBaseOpts = [
40 '-u root:root',
41 "--hostname=${dockerHostname}",
42 '--ulimit nofile=4096:8192',
43 "--name=${dockerContainerName}",
44 "--cpus=${dockerMaxCpus}"
45 ]
46
47 def dockerOptsFinal = (dockerBaseOpts + dockerExtraOpts).join(' ')
48 def img = docker.image(dockerImageName)
49 img.pull()
50
51 try {
52 img.inside(dockerOptsFinal) {
53 withEnv(envOpts) {
54 try {
55 // Currently, we don't have any other point to install
56 // runtime dependencies for tests.
57 if (baseRepoPreConfig) {
58 sh("""#!/bin/bash -xe
59 echo "Installing extra-deb dependencies inside docker:"
60 echo "APT::Get::AllowUnauthenticated 'true';" > /etc/apt/apt.conf.d/99setupAndTestNode
61 echo "APT::Get::Install-Suggests 'false';" >> /etc/apt/apt.conf.d/99setupAndTestNode
62 echo "APT::Get::Install-Recommends 'false';" >> /etc/apt/apt.conf.d/99setupAndTestNode
63 rm -vf /etc/apt/sources.list.d/* || true
64 echo 'deb [arch=amd64] http://mirror.mirantis.com/$DISTRIB_REVISION/ubuntu xenial main restricted universe' > /etc/apt/sources.list
65 echo 'deb [arch=amd64] http://mirror.mirantis.com/$DISTRIB_REVISION/ubuntu xenial-updates main restricted universe' >> /etc/apt/sources.list
66 apt-get update
67 apt-get install -y python-netaddr
68 """)
69 }
70 runCommands.sort().each { command, body ->
71 common.warningMsg("Running command: ${command}")
72 // doCall is the closure implementation in groovy, allow to pass arguments to closure
73 body.call()
74 }
75 // If we didn't dropped for now - test has been passed.
76 TestMarkerResult = true
77 }
78 finally {
79 runFinally.sort().each { command, body ->
80 common.warningMsg("Running ${command} command.")
81 // doCall is the closure implementation in groovy, allow to pass arguments to closure
82 body.call()
83 }
84 }
85 }
86 }
87 }
88 catch (Exception er) {
89 common.warningMsg("IgnoreMe:Something wrong with img.Message:\n" + er.toString())
90 }
91
92 try {
93 common.warningMsg("IgnoreMe:Force cleanup slave.Ignore docker-daemon errors")
94 timeout(time: 10, unit: 'SECONDS') {
95 sh(script: "set -x; docker kill ${dockerContainerName} || true", returnStdout: true)
96 }
97 timeout(time: 10, unit: 'SECONDS') {
98 sh(script: "set -x; docker rm --force ${dockerContainerName} || true", returnStdout: true)
99 }
100 }
101 catch (Exception er) {
102 common.warningMsg("IgnoreMe:Timeout to delete test docker container with force!Message:\n" + er.toString())
103 }
104
105 if (TestMarkerResult) {
106 common.infoMsg("Test finished: SUCCESS")
107 } else {
108 common.warningMsg("Test finished: FAILURE")
109 }
110 return TestMarkerResult
111}
112
113/**
114 * Wrapper over setupDockerAndTest, to test CC model.
115 *
116 * @param config - dict with params:
117 * dockerHostname - (required) salt master's name
118 * clusterName - (optional) model cluster name
119 * extraFormulas - (optional) extraFormulas to install. DEPRECATED
120 * formulasSource - (optional) formulas source (git or pkg, default pkg)
121 * reclassVersion - (optional) Version of used reclass (branch, tag, ...) (optional, default master)
122 * reclassEnv - (require) directory of model
123 * ignoreClassNotfound - (optional) Ignore missing classes for reclass model (default false)
124 * aptRepoUrl - (optional) package repository with salt formulas
125 * aptRepoGPG - (optional) GPG key for apt repository with formulas
126 * testContext - (optional) Description of test
127 Return: true\exception
128 */
129
130def testNode(LinkedHashMap config) {
131 def common = new com.mirantis.mk.Common()
132 def result = ''
133 def dockerHostname = config.get('dockerHostname')
134 def reclassEnv = config.get('reclassEnv')
135 def clusterName = config.get('clusterName', "")
136 def formulasSource = config.get('formulasSource', 'pkg')
137 def extraFormulas = config.get('extraFormulas', 'linux')
138 def reclassVersion = config.get('reclassVersion', 'master')
139 def ignoreClassNotfound = config.get('ignoreClassNotfound', false)
140 def aptRepoUrl = config.get('aptRepoUrl', "")
141 def aptRepoGPG = config.get('aptRepoGPG', "")
142 def testContext = config.get('testContext', 'test')
143 config['envOpts'] = [
144 "RECLASS_ENV=${reclassEnv}", "SALT_STOPSTART_WAIT=5",
145 "MASTER_HOSTNAME=${dockerHostname}", "CLUSTER_NAME=${clusterName}",
146 "MINION_ID=${dockerHostname}", "FORMULAS_SOURCE=${formulasSource}",
147 "EXTRA_FORMULAS=${extraFormulas}", "RECLASS_VERSION=${reclassVersion}",
148 "RECLASS_IGNORE_CLASS_NOTFOUND=${ignoreClassNotfound}", "DEBUG=1",
149 "APT_REPOSITORY=${aptRepoUrl}", "APT_REPOSITORY_GPG=${aptRepoGPG}",
150 "EXTRA_FORMULAS_PKG_ALL=true"
151 ]
152
153 config['runCommands'] = [
154 '001_Clone_salt_formulas_scripts': {
155 sh(script: 'git clone https://github.com/salt-formulas/salt-formulas-scripts /srv/salt/scripts', returnStdout: true)
156 },
157
158 '002_Prepare_something': {
159 sh('''rsync -ah ${RECLASS_ENV}/* /srv/salt/reclass && echo '127.0.1.2 salt' >> /etc/hosts
160 cd /srv/salt && find . -type f \\( -name '*.yml' -or -name '*.sh' \\) -exec sed -i 's/apt-mk.mirantis.com/apt.mirantis.net:8085/g' {} \\;
161 cd /srv/salt && find . -type f \\( -name '*.yml' -or -name '*.sh' \\) -exec sed -i 's/apt.mirantis.com/apt.mirantis.net:8085/g' {} \\;
162 ''')
163 },
164
165 // should be switched on packages later
166 '003_Install_reclass': {
167 sh('''for s in \$(python -c \"import site; print(' '.join(site.getsitepackages()))\"); do
168 sudo -H pip install --install-option=\"--prefix=\" --upgrade --force-reinstall -I \
169 -t \"\$s\" git+https://github.com/salt-formulas/reclass.git@${RECLASS_VERSION};
170 done
171 ''')
172 },
173
174 '004_Run_tests': {
175 def testTimeout = 40 * 60
176 timeout(time: testTimeout, unit: 'SECONDS') {
177 sh('''#!/bin/bash
178 source /srv/salt/scripts/bootstrap.sh
179 cd /srv/salt/scripts
180 source_local_envs
181 configure_salt_master
182 configure_salt_minion
183 install_salt_formula_pkg
184 source /srv/salt/scripts/bootstrap.sh
185 cd /srv/salt/scripts
186 saltservice_restart''')
187
188 sh('''#!/bin/bash
189 source /srv/salt/scripts/bootstrap.sh
190 cd /srv/salt/scripts
191 source_local_envs
192 saltmaster_init''')
193
194 sh('''#!/bin/bash
195 source /srv/salt/scripts/bootstrap.sh
196 cd /srv/salt/scripts
197 verify_salt_minions''')
198 }
199 }
200 ]
201 config['runFinally'] = [
202 '001_Archive_artefacts': {
203 sh(script: "cd /tmp; tar -czf ${env.WORKSPACE}/nodesinfo.tar.gz *reclass*", returnStatus: true)
204 archiveArtifacts artifacts: "nodesinfo.tar.gz"
205 }
206 ]
207 testResult = setupDockerAndTest(config)
208 if (testResult) {
209 common.infoMsg("Node test for context: ${testContext} model: ${reclassEnv} finished: SUCCESS")
210 } else {
211 throw new RuntimeException("Node test for context: ${testContext} model: ${reclassEnv} finished: FAILURE")
212 }
213 return testResult
214}
215
216/**
chnydaf14ea2a2017-05-26 15:07:47 +0200217 * setup and test salt-master
218 *
azvyagintsevb4e0c442018-09-12 17:00:04 +0300219 * @param masterName salt master's name
220 * @param clusterName model cluster name
221 * @param extraFormulas extraFormulas to install. DEPRECATED
222 * @param formulasSource formulas source (git or pkg)
223 * @param reclassVersion Version of used reclass (branch, tag, ...) (optional, default master)
224 * @param testDir directory of model
225 * @param formulasSource Salt formulas source type (optional, default pkg)
226 * @param formulasRevision APT revision for formulas (optional default stable)
Petr Michalec6414aa52017-08-17 14:32:52 +0200227 * @param ignoreClassNotfound Ignore missing classes for reclass model
azvyagintsevb4e0c442018-09-12 17:00:04 +0300228 * @param dockerMaxCpus max cpus passed to docker (default 0, disabled)
229 * @param legacyTestingMode do you want to enable legacy testing mode (iterating through the nodes directory definitions instead of reading cluster models)
230 * @param aptRepoUrl package repository with salt formulas
231 * @param aptRepoGPG GPG key for apt repository with formulas
azvyagintsev28fa9d92018-06-26 14:31:49 +0300232 * Return true | false
chnydaf14ea2a2017-05-26 15:07:47 +0200233 */
234
azvyagintsevb4e0c442018-09-12 17:00:04 +0300235def setupAndTestNode(masterName, clusterName, extraFormulas = '*', testDir, formulasSource = 'pkg',
Vasyl Saienko369ed902018-07-23 11:49:32 +0000236 formulasRevision = 'stable', reclassVersion = "master", dockerMaxCpus = 0,
azvyagintsev28fa9d92018-06-26 14:31:49 +0300237 ignoreClassNotfound = false, legacyTestingMode = false, aptRepoUrl = '', aptRepoGPG = '', dockerContainerName = false) {
azvyagintsevb4e0c442018-09-12 17:00:04 +0300238 def common = new com.mirantis.mk.Common()
azvyagintsev1cecc092018-09-14 13:19:16 +0300239 // TODO
240 common.errorMsg('You are using deprecated function!Please migrate to "setupDockerAndTest".' +
241 'It would be removed after 2018.q4 release!Pushing forced 60s sleep..')
242 sh('sleep 60')
azvyagintsevb4e0c442018-09-12 17:00:04 +0300243 // timeout for test execution (40min)
244 def testTimeout = 40 * 60
245 def TestMarkerResult = false
246 def saltOpts = "--retcode-passthrough --force-color"
247 def workspace = common.getWorkspace()
248 def img = docker.image("mirantis/salt:saltstack-ubuntu-xenial-salt-2017.7")
249 img.pull()
chnydaf14ea2a2017-05-26 15:07:47 +0200250
azvyagintsev635affb2018-09-13 13:02:54 +0300251 if (formulasSource == 'pkg') {
252 if (extraFormulas) {
253 common.warningMsg("You have passed deprecated variable:extraFormulas=${extraFormulas}. " +
254 "\n It would be ignored, and all formulas would be installed anyway")
255 }
azvyagintsevb4e0c442018-09-12 17:00:04 +0300256 }
257 if (!dockerContainerName) {
258 dockerContainerName = 'setupAndTestNode' + UUID.randomUUID().toString()
259 }
260 def dockerMaxCpusOpt = "--cpus=4"
261 if (dockerMaxCpus > 0) {
262 dockerMaxCpusOpt = "--cpus=${dockerMaxCpus}"
263 }
264 try {
265 img.inside("-u root:root --hostname=${masterName} --ulimit nofile=4096:8192 ${dockerMaxCpusOpt} --name=${dockerContainerName}") {
azvyagintsev635affb2018-09-13 13:02:54 +0300266 withEnv(["FORMULAS_SOURCE=${formulasSource}", "EXTRA_FORMULAS=${extraFormulas}", "EXTRA_FORMULAS_PKG_ALL=true",
azvyagintsevb4e0c442018-09-12 17:00:04 +0300267 "DISTRIB_REVISION=${formulasRevision}",
268 "DEBUG=1", "MASTER_HOSTNAME=${masterName}",
269 "CLUSTER_NAME=${clusterName}", "MINION_ID=${masterName}",
270 "RECLASS_VERSION=${reclassVersion}", "RECLASS_IGNORE_CLASS_NOTFOUND=${ignoreClassNotfound}",
271 "APT_REPOSITORY=${aptRepoUrl}", "SALT_STOPSTART_WAIT=5",
272 "APT_REPOSITORY_GPG=${aptRepoGPG}"]) {
273 try {
274 // Currently, we don't have any other point to install
275 // runtime dependencies for tests.
276 sh("""#!/bin/bash -xe
azvyagintsev1bfe6842018-08-09 18:40:17 +0200277 echo "Installing extra-deb dependencies inside docker:"
278 echo "APT::Get::AllowUnauthenticated 'true';" > /etc/apt/apt.conf.d/99setupAndTestNode
279 echo "APT::Get::Install-Suggests 'false';" >> /etc/apt/apt.conf.d/99setupAndTestNode
280 echo "APT::Get::Install-Recommends 'false';" >> /etc/apt/apt.conf.d/99setupAndTestNode
281 rm -vf /etc/apt/sources.list.d/* || true
282 echo 'deb [arch=amd64] http://mirror.mirantis.com/$DISTRIB_REVISION/ubuntu xenial main restricted universe' > /etc/apt/sources.list
283 echo 'deb [arch=amd64] http://mirror.mirantis.com/$DISTRIB_REVISION/ubuntu xenial-updates main restricted universe' >> /etc/apt/sources.list
284 apt-get update
285 apt-get install -y python-netaddr
286 """)
azvyagintsevb4e0c442018-09-12 17:00:04 +0300287 sh(script: "git clone https://github.com/salt-formulas/salt-formulas-scripts /srv/salt/scripts", returnStdout: true)
288 sh("""rsync -ah ${testDir}/* /srv/salt/reclass && echo '127.0.1.2 salt' >> /etc/hosts
azvyagintsev1bfe6842018-08-09 18:40:17 +0200289 cd /srv/salt && find . -type f \\( -name '*.yml' -or -name '*.sh' \\) -exec sed -i 's/apt-mk.mirantis.com/apt.mirantis.net:8085/g' {} \\;
290 cd /srv/salt && find . -type f \\( -name '*.yml' -or -name '*.sh' \\) -exec sed -i 's/apt.mirantis.com/apt.mirantis.net:8085/g' {} \\;
291 """)
azvyagintsevb4e0c442018-09-12 17:00:04 +0300292 // FIXME: should be changed to use reclass from mcp_extra_nigtly?
293 sh("""for s in \$(python -c \"import site; print(' '.join(site.getsitepackages()))\"); do
azvyagintsev1bfe6842018-08-09 18:40:17 +0200294 sudo -H pip install --install-option=\"--prefix=\" --upgrade --force-reinstall -I \
295 -t \"\$s\" git+https://github.com/salt-formulas/reclass.git@${reclassVersion};
296 done""")
azvyagintsevb4e0c442018-09-12 17:00:04 +0300297 timeout(time: testTimeout, unit: 'SECONDS') {
298 sh('''#!/bin/bash
azvyagintsev1bfe6842018-08-09 18:40:17 +0200299 source /srv/salt/scripts/bootstrap.sh
300 cd /srv/salt/scripts
301 source_local_envs
302 configure_salt_master
303 configure_salt_minion
304 install_salt_formula_pkg
305 source /srv/salt/scripts/bootstrap.sh
306 cd /srv/salt/scripts
307 saltservice_restart''')
azvyagintsevb4e0c442018-09-12 17:00:04 +0300308 sh('''#!/bin/bash
azvyagintsev1bfe6842018-08-09 18:40:17 +0200309 source /srv/salt/scripts/bootstrap.sh
310 cd /srv/salt/scripts
311 source_local_envs
312 saltmaster_init''')
313
azvyagintsevb4e0c442018-09-12 17:00:04 +0300314 if (!legacyTestingMode.toBoolean()) {
315 sh('''#!/bin/bash
azvyagintsev1bfe6842018-08-09 18:40:17 +0200316 source /srv/salt/scripts/bootstrap.sh
317 cd /srv/salt/scripts
318 verify_salt_minions
319 ''')
azvyagintsevb4e0c442018-09-12 17:00:04 +0300320 }
321 }
322 // If we didn't dropped for now - test has been passed.
323 TestMarkerResult = true
324 }
325
326 finally {
327 // Collect rendered per-node data.Those info could be simply used
328 // for diff processing. Data was generated via reclass.cli --nodeinfo,
329 /// during verify_salt_minions.
330 sh(script: "cd /tmp; tar -czf ${env.WORKSPACE}/nodesinfo.tar.gz *reclass*", returnStatus: true)
331 archiveArtifacts artifacts: "nodesinfo.tar.gz"
332 }
azvyagintsev1bfe6842018-08-09 18:40:17 +0200333 }
azvyagintsev1bfe6842018-08-09 18:40:17 +0200334 }
chnydaf14ea2a2017-05-26 15:07:47 +0200335 }
azvyagintsevb4e0c442018-09-12 17:00:04 +0300336 catch (Exception er) {
337 common.warningMsg("IgnoreMe:Something wrong with img.Message:\n" + er.toString())
338 }
azvyagintsev28fa9d92018-06-26 14:31:49 +0300339
azvyagintsevb4e0c442018-09-12 17:00:04 +0300340 if (legacyTestingMode.toBoolean()) {
341 common.infoMsg("Running legacy mode test for master hostname ${masterName}")
342 def nodes = sh(script: "find /srv/salt/reclass/nodes -name '*.yml' | grep -v 'cfg*.yml'", returnStdout: true)
343 for (minion in nodes.tokenize()) {
344 def basename = sh(script: "set +x;basename ${minion} .yml", returnStdout: true)
345 if (!basename.trim().contains(masterName)) {
346 testMinion(basename.trim())
347 }
348 }
azvyagintsev28fa9d92018-06-26 14:31:49 +0300349 }
azvyagintsev28fa9d92018-06-26 14:31:49 +0300350
azvyagintsevb4e0c442018-09-12 17:00:04 +0300351 try {
352 common.warningMsg("IgnoreMe:Force cleanup slave.Ignore docker-daemon errors")
353 timeout(time: 10, unit: 'SECONDS') {
354 sh(script: "set -x; docker kill ${dockerContainerName} || true", returnStdout: true)
355 }
356 timeout(time: 10, unit: 'SECONDS') {
357 sh(script: "set -x; docker rm --force ${dockerContainerName} || true", returnStdout: true)
358 }
azvyagintsev28fa9d92018-06-26 14:31:49 +0300359 }
azvyagintsevb4e0c442018-09-12 17:00:04 +0300360 catch (Exception er) {
361 common.warningMsg("IgnoreMe:Timeout to delete test docker container with force!Message:\n" + er.toString())
azvyagintsev28fa9d92018-06-26 14:31:49 +0300362 }
azvyagintsev28fa9d92018-06-26 14:31:49 +0300363
azvyagintsevb4e0c442018-09-12 17:00:04 +0300364 if (TestMarkerResult) {
365 common.infoMsg("Test finished: SUCCESS")
366 } else {
367 common.warningMsg("Test finished: FAILURE")
368 }
369 return TestMarkerResult
azvyagintsev28fa9d92018-06-26 14:31:49 +0300370
chnydaf14ea2a2017-05-26 15:07:47 +0200371}
372
373/**
374 * Test salt-minion
375 *
azvyagintsev28fa9d92018-06-26 14:31:49 +0300376 * @param minion salt minion
chnydaf14ea2a2017-05-26 15:07:47 +0200377 */
378
azvyagintsev28fa9d92018-06-26 14:31:49 +0300379def testMinion(minionName) {
azvyagintsevb4e0c442018-09-12 17:00:04 +0300380 sh(script: "bash -c 'source /srv/salt/scripts/bootstrap.sh; cd /srv/salt/scripts && verify_salt_minion ${minionName}'", returnStdout: true)
Jakub Joseffa6ad8d2017-06-26 18:29:55 +0200381}
azvyagintsev2b279d82018-08-07 17:22:54 +0200382
azvyagintsev2b279d82018-08-07 17:22:54 +0200383/**
384 * Wrapper over setupAndTestNode, to test exactly one CC model.
azvyagintsevb4e0c442018-09-12 17:00:04 +0300385 Whole workspace and model - should be pre-rendered and passed via MODELS_TARGZ
386 Flow: grab all data, and pass to setupAndTestNode function
387 under-modell will be directly mirrored to `model/{cfg.testReclassEnv}/* /srv/salt/reclass/*`
azvyagintsev2b279d82018-08-07 17:22:54 +0200388 *
389 * @param cfg - dict with params:
azvyagintsevb4e0c442018-09-12 17:00:04 +0300390 MODELS_TARGZ http link to arch with (models|contexts|global_reclass)
391 modelFile
392 DockerCName directly passed to setupAndTestNode
393 EXTRA_FORMULAS directly passed to setupAndTestNode
394 DISTRIB_REVISION directly passed to setupAndTestNode
395 reclassVersion directly passed to setupAndTestNode
azvyagintsev2b279d82018-08-07 17:22:54 +0200396
azvyagintsevb4e0c442018-09-12 17:00:04 +0300397 Return: true\exception
azvyagintsev2b279d82018-08-07 17:22:54 +0200398 */
399
400def testCCModel(cfg) {
azvyagintsevb4e0c442018-09-12 17:00:04 +0300401 def common = new com.mirantis.mk.Common()
azvyagintsev1cecc092018-09-14 13:19:16 +0300402 common.errorMsg('You are using deprecated function!Please migrate to "testNode".' +
403 'It would be removed after 2018.q4 release!Pushing forced 60s sleep..')
404 sh('sleep 60')
azvyagintsevb4e0c442018-09-12 17:00:04 +0300405 sh(script: 'find . -mindepth 1 -delete || true', returnStatus: true)
406 sh(script: "wget --progress=dot:mega --auth-no-challenge -O models.tar.gz ${cfg.MODELS_TARGZ}")
407 // unpack data
408 sh(script: "tar -xzf models.tar.gz ")
409 common.infoMsg("Going to test exactly one context: ${cfg.modelFile}\n, with params: ${cfg}")
410 content = readFile(file: cfg.modelFile)
411 templateContext = readYaml text: content
412 clusterName = templateContext.default_context.cluster_name
413 clusterDomain = templateContext.default_context.cluster_domain
azvyagintsev2b279d82018-08-07 17:22:54 +0200414
azvyagintsevb4e0c442018-09-12 17:00:04 +0300415 def testResult = false
416 testResult = setupAndTestNode(
417 "cfg01.${clusterDomain}",
418 clusterName,
419 '',
420 cfg.testReclassEnv, // Sync into image exactly one env
421 'pkg',
422 cfg.DISTRIB_REVISION,
423 cfg.reclassVersion,
424 0,
425 false,
426 false,
427 '',
428 '',
429 cfg.DockerCName)
430 if (testResult) {
431 common.infoMsg("testCCModel for context: ${cfg.modelFile} model: ${cfg.testReclassEnv} finished: SUCCESS")
432 } else {
433 throw new RuntimeException("testCCModel for context: ${cfg.modelFile} model: ${cfg.testReclassEnv} finished: FAILURE")
434 }
435 return testResult
azvyagintsev2b279d82018-08-07 17:22:54 +0200436}