1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-03-03 15:02:35 +02:00

Unit test for warAction: rolling-update

This commit is contained in:
Milko Todorov 2018-01-17 14:01:15 +01:00
parent 48fb7c76e3
commit d9e8128860

View File

@ -183,18 +183,41 @@ class NeoDeploymentTest extends PiperTestBase {
assert messages[1] == "[neoDeploy] Neo executable \"/opt/neo/tools/neo.sh\" retrieved from environment."
}
@Test
void warFileParamsDeployModeRollingUpdateTest() {
binding.getVariable('env')['NEO_HOME'] = '/opt/neo'
new File(warArchivePath) << "dummy war archive"
withPipeline(warParamsDeployModePipeline()).execute(warArchivePath, 'warParams', 'lite', 'rolling-update')
assert shellCalls[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" rolling-update --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*\.war" --host 'test\.deploy\.host\.com' --account 'trialuser123' --application 'testApp' --runtime 'neo-javaee6-wp' --runtime-version '2\.125' --size 'lite'/
assert messages[1] == "[neoDeploy] Neo executable \"/opt/neo/tools/neo.sh\" retrieved from environment."
}
@Test
void warPropertiesFileDeployModeTest() {
binding.getVariable('env')['NEO_HOME'] = '/opt/neo'
new File(warArchivePath) << "dummy war archive"
new File(propertiesFilePath) << "dummy properties file"
withPipeline(warPropertiesFileDeployModePipeline()).execute(warArchivePath, propertiesFilePath, 'warPropertiesFile')
withPipeline(warPropertiesFileDeployModePipeline()).execute(warArchivePath, propertiesFilePath, 'warPropertiesFile', 'deploy')
assert shellCalls[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*\.war" .*\.properties/
assert messages[1] == "[neoDeploy] Neo executable \"/opt/neo/tools/neo.sh\" retrieved from environment."
}
@Test
void warPropertiesFileDeployModeRollingUpdateTest() {
binding.getVariable('env')['NEO_HOME'] = '/opt/neo'
new File(warArchivePath) << "dummy war archive"
new File(propertiesFilePath) << "dummy properties file"
withPipeline(warPropertiesFileDeployModePipeline()).execute(warArchivePath, propertiesFilePath, 'warPropertiesFile', 'rolling-update')
assert shellCalls[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" rolling-update --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*\.war" .*\.properties/
assert messages[1] == "[neoDeploy] Neo executable \"/opt/neo/tools/neo.sh\" retrieved from environment."
}
@Test
void applicationNameNotProvidedTest() {
new File(warArchivePath) << "dummy war archive"
@ -416,10 +439,10 @@ class NeoDeploymentTest extends PiperTestBase {
return """
@Library('piper-library-os')
execute(warArchivePath, propertiesFilePath, deployMode) {
execute(warArchivePath, propertiesFilePath, deployMode, warAction) {
node() {
neoDeploy script: this, deployMode: deployMode, archivePath: warArchivePath, propertiesFile: propertiesFilePath
neoDeploy script: this, deployMode: deployMode, archivePath: warArchivePath, propertiesFile: propertiesFilePath, warAction: warAction
}
}