mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
Merge pull request #79 from alejandraferreirovidal/cleanUpNeoDeploymentTest
clean up NeoDeploymentTest
This commit is contained in:
commit
ac6cc2aa60
@ -4,6 +4,8 @@ import org.junit.rules.TemporaryFolder
|
|||||||
|
|
||||||
import com.lesfurets.jenkins.unit.BasePipelineTest
|
import com.lesfurets.jenkins.unit.BasePipelineTest
|
||||||
|
|
||||||
|
import org.junit.BeforeClass
|
||||||
|
import org.junit.ClassRule
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -17,34 +19,42 @@ import util.Rules
|
|||||||
|
|
||||||
class NeoDeploymentTest extends BasePipelineTest {
|
class NeoDeploymentTest extends BasePipelineTest {
|
||||||
|
|
||||||
|
@ClassRule
|
||||||
|
public static TemporaryFolder tmp = new TemporaryFolder()
|
||||||
|
|
||||||
private ExpectedException thrown = new ExpectedException().none()
|
private ExpectedException thrown = new ExpectedException().none()
|
||||||
private TemporaryFolder tmp = new TemporaryFolder()
|
|
||||||
private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this)
|
private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this)
|
||||||
private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this)
|
private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this)
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public RuleChain ruleChain = Rules.getCommonRules(this)
|
public RuleChain ruleChain = Rules.getCommonRules(this)
|
||||||
.around(thrown)
|
.around(thrown)
|
||||||
.around(tmp)
|
|
||||||
.around(jlr)
|
.around(jlr)
|
||||||
.around(jscr)
|
.around(jscr)
|
||||||
|
|
||||||
def workspacePath
|
private static workspacePath
|
||||||
def warArchiveName
|
private static warArchiveName
|
||||||
def propertiesFileName
|
private static propertiesFileName
|
||||||
def archiveName
|
private static archiveName
|
||||||
|
|
||||||
|
|
||||||
def neoDeployScript
|
def neoDeployScript
|
||||||
def cpe
|
def cpe
|
||||||
|
|
||||||
@Before
|
@BeforeClass
|
||||||
void init() {
|
static void createTestFiles() {
|
||||||
|
|
||||||
workspacePath = "${tmp.newFolder("workspace").toURI().getPath()}"
|
workspacePath = "${tmp.getRoot()}"
|
||||||
warArchiveName = 'warArchive.war'
|
warArchiveName = 'warArchive.war'
|
||||||
propertiesFileName = 'config.properties'
|
propertiesFileName = 'config.properties'
|
||||||
archiveName = "archive.mtar"
|
archiveName = 'archive.mtar'
|
||||||
|
|
||||||
|
tmp.newFile(warArchiveName) << 'dummy war archive'
|
||||||
|
tmp.newFile(propertiesFileName) << 'dummy properties file'
|
||||||
|
tmp.newFile(archiveName) << 'dummy archive'
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
void init() {
|
||||||
|
|
||||||
helper.registerAllowedMethod('dockerExecute', [Map, Closure], null)
|
helper.registerAllowedMethod('dockerExecute', [Map, Closure], null)
|
||||||
helper.registerAllowedMethod('fileExists', [String], { s -> return new File(workspacePath, s).exists() })
|
helper.registerAllowedMethod('fileExists', [String], { s -> return new File(workspacePath, s).exists() })
|
||||||
@ -66,71 +76,50 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
binding.setVariable('env', [:])
|
binding.setVariable('env', ['NEO_HOME':'/opt/neo'])
|
||||||
|
|
||||||
neoDeployScript = loadScript("neoDeploy.groovy").neoDeploy
|
neoDeployScript = loadScript('neoDeploy.groovy').neoDeploy
|
||||||
cpe = loadScript('commonPipelineEnvironment.groovy').commonPipelineEnvironment
|
cpe = loadScript('commonPipelineEnvironment.groovy').commonPipelineEnvironment
|
||||||
|
|
||||||
|
cpe.configuration = [steps:[neoDeploy: [host: 'test.deploy.host.com', account: 'trialuser123']]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void straightForwardTestConfigViaConfigProperties() {
|
void straightForwardTestConfigViaConfigProperties() {
|
||||||
|
|
||||||
binding.getVariable('env')['NEO_HOME'] = '/opt/neo'
|
|
||||||
|
|
||||||
new File(workspacePath, archiveName) << "dummy archive"
|
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
||||||
|
|
||||||
|
cpe.configuration = [:]
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: archiveName,
|
archivePath: archiveName,
|
||||||
neoCredentialsId: 'myCredentialsId'
|
neoCredentialsId: 'myCredentialsId'
|
||||||
)
|
)
|
||||||
|
|
||||||
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy-mta --host 'test\.deploy\.host\.com' --account 'trialuser123' --synchronous --user 'anonymous' --password '\*\*\*\*\*\*\*\*' --source ".*"/
|
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy-mta --host 'test\.deploy\.host\.com' --account 'trialuser123' --synchronous --user 'anonymous' --password '\*\*\*\*\*\*\*\*' --source ".*"/
|
||||||
|
|
||||||
assert jlr.log.contains("[neoDeploy] Neo executable \"/opt/neo/tools/neo.sh\" retrieved from environment.")
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void straightForwardTestConfigViaConfiguration() {
|
void straightForwardTestConfigViaConfiguration() {
|
||||||
|
|
||||||
binding.getVariable('env')['NEO_HOME'] = '/opt/neo'
|
|
||||||
|
|
||||||
new File(workspacePath, archiveName) << "dummy archive"
|
|
||||||
|
|
||||||
cpe.configuration.put('steps', [neoDeploy: [host: 'test.deploy.host.com',
|
|
||||||
account: 'trialuser123']])
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: archiveName,
|
archivePath: archiveName,
|
||||||
neoCredentialsId: 'myCredentialsId'
|
neoCredentialsId: 'myCredentialsId'
|
||||||
)
|
)
|
||||||
|
|
||||||
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy-mta --host 'test\.deploy\.host\.com' --account 'trialuser123' --synchronous --user 'anonymous' --password '\*\*\*\*\*\*\*\*' --source ".*"/
|
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy-mta --host 'test\.deploy\.host\.com' --account 'trialuser123' --synchronous --user 'anonymous' --password '\*\*\*\*\*\*\*\*' --source ".*"/
|
||||||
|
|
||||||
assert jlr.log.contains("[neoDeploy] Neo executable \"/opt/neo/tools/neo.sh\" retrieved from environment.")
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void straightForwardTestConfigViaConfigurationAndViaConfigProperties() {
|
void straightForwardTestConfigViaConfigurationAndViaConfigProperties() {
|
||||||
|
|
||||||
//configuration via configurationFramekwork superseds.
|
|
||||||
binding.getVariable('env')['NEO_HOME'] = '/opt/neo'
|
|
||||||
|
|
||||||
new File(workspacePath, archiveName) << "dummy archive"
|
|
||||||
|
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'configProperties.deploy.host.com')
|
cpe.setConfigProperty('DEPLOY_HOST', 'configProperties.deploy.host.com')
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'configPropsUser123')
|
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'configPropsUser123')
|
||||||
|
|
||||||
cpe.configuration.put('steps', [neoDeploy: [host: 'configuration-frwk.deploy.host.com',
|
cpe.configuration = [steps:[neoDeploy: [host: 'configuration-frwk.deploy.host.com',
|
||||||
account: 'configurationFrwkUser123']])
|
account: 'configurationFrwkUser123']]]
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: archiveName,
|
archivePath: archiveName,
|
||||||
@ -138,25 +127,15 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy-mta --host 'configuration-frwk\.deploy\.host\.com' --account 'configurationFrwkUser123' --synchronous --user 'anonymous' --password '\*\*\*\*\*\*\*\*' --source ".*"/
|
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy-mta --host 'configuration-frwk\.deploy\.host\.com' --account 'configurationFrwkUser123' --synchronous --user 'anonymous' --password '\*\*\*\*\*\*\*\*' --source ".*"/
|
||||||
|
|
||||||
assert jlr.log.contains("[neoDeploy] Neo executable \"/opt/neo/tools/neo.sh\" retrieved from environment.")
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void badCredentialsIdTest() {
|
void badCredentialsIdTest() {
|
||||||
|
|
||||||
binding.getVariable('env')['NEO_HOME'] = '/opt/neo'
|
|
||||||
|
|
||||||
new File(workspacePath, archiveName) << "dummy archive"
|
|
||||||
|
|
||||||
thrown.expect(MissingPropertyException)
|
thrown.expect(MissingPropertyException)
|
||||||
thrown.expectMessage('No such property: username')
|
thrown.expectMessage('No such property: username')
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: archiveName,
|
archivePath: archiveName,
|
||||||
neoCredentialsId: 'badCredentialsId'
|
neoCredentialsId: 'badCredentialsId'
|
||||||
@ -167,56 +146,51 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
@Test
|
@Test
|
||||||
void credentialsIdNotProvidedTest() {
|
void credentialsIdNotProvidedTest() {
|
||||||
|
|
||||||
binding.getVariable('env')['NEO_HOME'] = '/opt/neo'
|
|
||||||
|
|
||||||
new File(workspacePath, archiveName) << "dummy archive"
|
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: archiveName
|
archivePath: archiveName
|
||||||
)
|
)
|
||||||
|
|
||||||
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy-mta --host 'test\.deploy\.host\.com' --account 'trialuser123' --synchronous --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*"/
|
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy-mta --host 'test\.deploy\.host\.com' --account 'trialuser123' --synchronous --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*"/
|
||||||
|
|
||||||
assert jlr.log.contains("[neoDeploy] Neo executable \"/opt/neo/tools/neo.sh\" retrieved from environment.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void neoHomeNotSetTest() {
|
void neoHomeNotSetTest() {
|
||||||
|
|
||||||
new File(workspacePath, archiveName) << "dummy archive"
|
binding.setVariable('env', [:])
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: archiveName
|
archivePath: archiveName
|
||||||
)
|
)
|
||||||
|
|
||||||
assert jscr.shell[0] =~ /#!\/bin\/bash "neo.sh" deploy-mta --host 'test\.deploy\.host\.com' --account 'trialuser123' --synchronous --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*"/
|
assert jscr.shell[0].contains('"neo.sh" deploy-mta')
|
||||||
|
assert jlr.log.contains('Using Neo executable from PATH.')
|
||||||
assert jlr.log.contains("Using Neo executable from PATH.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void neoHomeAsParameterTest() {
|
void neoHomeAsParameterTest() {
|
||||||
|
|
||||||
new File(workspacePath, archiveName) << "dummy archive"
|
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: archiveName,
|
archivePath: archiveName,
|
||||||
neoCredentialsId: 'myCredentialsId',
|
neoCredentialsId: 'myCredentialsId',
|
||||||
neoHome: '/etc/neo'
|
neoHome: '/etc/neo'
|
||||||
)
|
)
|
||||||
|
|
||||||
assert jscr.shell[0] =~ /#!\/bin\/bash "\/etc\/neo\/tools\/neo\.sh" deploy-mta --host 'test\.deploy\.host\.com' --account 'trialuser123' --synchronous --user 'anonymous' --password '\*\*\*\*\*\*\*\*' --source ".*"/
|
assert jscr.shell[0].contains('"/etc/neo/tools/neo.sh" deploy-mta')
|
||||||
|
assert jlr.log.contains('[neoDeploy] Neo executable "/etc/neo/tools/neo.sh" retrieved from configuration.')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void neoHomeFromEnvironmentTest() {
|
||||||
|
|
||||||
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
|
archivePath: archiveName
|
||||||
|
)
|
||||||
|
|
||||||
|
assert jscr.shell[0].contains('"/opt/neo/tools/neo.sh" deploy-mta')
|
||||||
|
assert jlr.log.contains('[neoDeploy] Neo executable "/opt/neo/tools/neo.sh" retrieved from environment.')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -226,9 +200,6 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
thrown.expect(Exception)
|
thrown.expect(Exception)
|
||||||
thrown.expectMessage('Archive path not configured (parameter "archivePath").')
|
thrown.expectMessage('Archive path not configured (parameter "archivePath").')
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe])
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe])
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,49 +208,34 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
void wrongArchivePathProvidedTest() {
|
void wrongArchivePathProvidedTest() {
|
||||||
|
|
||||||
thrown.expect(AbortException)
|
thrown.expect(AbortException)
|
||||||
thrown.expectMessage("Archive cannot be found")
|
thrown.expectMessage('Archive cannot be found')
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: archiveName)
|
archivePath: 'wrongArchiveName')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void scriptNotProvidedTest() {
|
void scriptNotProvidedTest() {
|
||||||
|
|
||||||
new File(workspacePath, archiveName) << "dummy archive"
|
|
||||||
|
|
||||||
thrown.expect(Exception)
|
thrown.expect(Exception)
|
||||||
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR host')
|
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR host')
|
||||||
|
|
||||||
|
cpe.configuration = [:]
|
||||||
|
|
||||||
neoDeployScript.call(archivePath: archiveName)
|
neoDeployScript.call(archivePath: archiveName)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void mtaDeployModeTest() {
|
void mtaDeployModeTest() {
|
||||||
binding.getVariable('env')['NEO_HOME'] = '/opt/neo'
|
|
||||||
new File(workspacePath, archiveName) << "dummy archive"
|
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe], archivePath: archiveName, deployMode: 'mta')
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe], archivePath: archiveName, deployMode: 'mta')
|
||||||
|
|
||||||
|
|
||||||
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy-mta --host 'test\.deploy\.host\.com' --account 'trialuser123' --synchronous --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*"/
|
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy-mta --host 'test\.deploy\.host\.com' --account 'trialuser123' --synchronous --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*"/
|
||||||
assert jlr.log.contains("[neoDeploy] Neo executable \"/opt/neo/tools/neo.sh\" retrieved from environment.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void warFileParamsDeployModeTest() {
|
void warFileParamsDeployModeTest() {
|
||||||
binding.getVariable('env')['NEO_HOME'] = '/opt/neo'
|
|
||||||
new File(workspacePath, warArchiveName) << "dummy war archive"
|
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
applicationName: 'testApp',
|
applicationName: 'testApp',
|
||||||
@ -291,16 +247,10 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
archivePath: warArchiveName)
|
archivePath: warArchiveName)
|
||||||
|
|
||||||
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy --host 'test\.deploy\.host\.com' --account 'trialuser123' --application 'testApp' --runtime 'neo-javaee6-wp' --runtime-version '2\.125' --size 'lite' --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*\.war"/
|
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy --host 'test\.deploy\.host\.com' --account 'trialuser123' --application 'testApp' --runtime 'neo-javaee6-wp' --runtime-version '2\.125' --size 'lite' --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*\.war"/
|
||||||
assert jlr.log.contains("[neoDeploy] Neo executable \"/opt/neo/tools/neo.sh\" retrieved from environment.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void warFileParamsDeployModeRollingUpdateTest() {
|
void warFileParamsDeployModeRollingUpdateTest() {
|
||||||
binding.getVariable('env')['NEO_HOME'] = '/opt/neo'
|
|
||||||
new File(workspacePath, warArchiveName) << "dummy war archive"
|
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: warArchiveName,
|
archivePath: warArchiveName,
|
||||||
@ -312,14 +262,10 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
vmSize: 'lite')
|
vmSize: 'lite')
|
||||||
|
|
||||||
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" rolling-update --host 'test\.deploy\.host\.com' --account 'trialuser123' --application 'testApp' --runtime 'neo-javaee6-wp' --runtime-version '2\.125' --size 'lite' --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*\.war"/
|
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" rolling-update --host 'test\.deploy\.host\.com' --account 'trialuser123' --application 'testApp' --runtime 'neo-javaee6-wp' --runtime-version '2\.125' --size 'lite' --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*\.war"/
|
||||||
assert jlr.log.contains("[neoDeploy] Neo executable \"/opt/neo/tools/neo.sh\" retrieved from environment.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void warPropertiesFileDeployModeTest() {
|
void warPropertiesFileDeployModeTest() {
|
||||||
binding.getVariable('env')['NEO_HOME'] = '/opt/neo'
|
|
||||||
new File(workspacePath, warArchiveName) << "dummy war archive"
|
|
||||||
new File(workspacePath, propertiesFileName) << "dummy properties file"
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: warArchiveName,
|
archivePath: warArchiveName,
|
||||||
@ -332,14 +278,10 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
vmSize: 'lite')
|
vmSize: 'lite')
|
||||||
|
|
||||||
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy .*\.properties --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*\.war"/
|
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" deploy .*\.properties --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*\.war"/
|
||||||
assert jlr.log.contains("[neoDeploy] Neo executable \"/opt/neo/tools/neo.sh\" retrieved from environment.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void warPropertiesFileDeployModeRollingUpdateTest() {
|
void warPropertiesFileDeployModeRollingUpdateTest() {
|
||||||
binding.getVariable('env')['NEO_HOME'] = '/opt/neo'
|
|
||||||
new File(workspacePath, warArchiveName) << "dummy war archive"
|
|
||||||
new File(workspacePath, propertiesFileName) << "dummy properties file"
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: warArchiveName,
|
archivePath: warArchiveName,
|
||||||
@ -352,19 +294,14 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
vmSize: 'lite')
|
vmSize: 'lite')
|
||||||
|
|
||||||
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" rolling-update .*\.properties --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*\.war"/
|
assert jscr.shell[0] =~ /#!\/bin\/bash "\/opt\/neo\/tools\/neo\.sh" rolling-update .*\.properties --user 'defaultUser' --password '\*\*\*\*\*\*\*\*' --source ".*\.war"/
|
||||||
assert jlr.log.contains("[neoDeploy] Neo executable \"/opt/neo/tools/neo.sh\" retrieved from environment.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void applicationNameNotProvidedTest() {
|
void applicationNameNotProvidedTest() {
|
||||||
new File(workspacePath, warArchiveName) << "dummy war archive"
|
|
||||||
|
|
||||||
thrown.expect(Exception)
|
thrown.expect(Exception)
|
||||||
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR applicationName')
|
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR applicationName')
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: warArchiveName,
|
archivePath: warArchiveName,
|
||||||
deployMode: 'warParams',
|
deployMode: 'warParams',
|
||||||
@ -375,14 +312,10 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void runtimeNotProvidedTest() {
|
void runtimeNotProvidedTest() {
|
||||||
new File(workspacePath, warArchiveName) << "dummy war archive"
|
|
||||||
|
|
||||||
thrown.expect(Exception)
|
thrown.expect(Exception)
|
||||||
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR runtime')
|
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR runtime')
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: warArchiveName,
|
archivePath: warArchiveName,
|
||||||
applicationName: 'testApp',
|
applicationName: 'testApp',
|
||||||
@ -392,14 +325,10 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void runtimeVersionNotProvidedTest() {
|
void runtimeVersionNotProvidedTest() {
|
||||||
new File(workspacePath, warArchiveName) << "dummy war archive"
|
|
||||||
|
|
||||||
thrown.expect(Exception)
|
thrown.expect(Exception)
|
||||||
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR runtimeVersion')
|
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR runtimeVersion')
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: warArchiveName,
|
archivePath: warArchiveName,
|
||||||
applicationName: 'testApp',
|
applicationName: 'testApp',
|
||||||
@ -409,14 +338,10 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void illegalDeployModeTest() {
|
void illegalDeployModeTest() {
|
||||||
new File(workspacePath, warArchiveName) << "dummy war archive"
|
|
||||||
|
|
||||||
thrown.expect(Exception)
|
thrown.expect(Exception)
|
||||||
thrown.expectMessage("[neoDeploy] Invalid deployMode = 'illegalMode'. Valid 'deployMode' values are: 'mta', 'warParams' and 'warPropertiesFile'")
|
thrown.expectMessage("[neoDeploy] Invalid deployMode = 'illegalMode'. Valid 'deployMode' values are: 'mta', 'warParams' and 'warPropertiesFile'")
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: warArchiveName,
|
archivePath: warArchiveName,
|
||||||
deployMode: 'illegalMode',
|
deployMode: 'illegalMode',
|
||||||
@ -429,14 +354,10 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void illegalVMSizeTest() {
|
void illegalVMSizeTest() {
|
||||||
new File(workspacePath, warArchiveName) << "dummy war archive"
|
|
||||||
|
|
||||||
thrown.expect(Exception)
|
thrown.expect(Exception)
|
||||||
thrown.expectMessage("[neoDeploy] Invalid vmSize = 'illegalVM'. Valid 'vmSize' values are: 'lite', 'pro', 'prem' and 'prem-plus'.")
|
thrown.expectMessage("[neoDeploy] Invalid vmSize = 'illegalVM'. Valid 'vmSize' values are: 'lite', 'pro', 'prem' and 'prem-plus'.")
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: warArchiveName,
|
archivePath: warArchiveName,
|
||||||
deployMode: 'warParams',
|
deployMode: 'warParams',
|
||||||
@ -449,14 +370,10 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void illegalWARActionTest() {
|
void illegalWARActionTest() {
|
||||||
new File(workspacePath, warArchiveName) << "dummy war archive"
|
|
||||||
|
|
||||||
thrown.expect(Exception)
|
thrown.expect(Exception)
|
||||||
thrown.expectMessage("[neoDeploy] Invalid warAction = 'illegalWARAction'. Valid 'warAction' values are: 'deploy' and 'rolling-update'.")
|
thrown.expectMessage("[neoDeploy] Invalid warAction = 'illegalWARAction'. Valid 'warAction' values are: 'deploy' and 'rolling-update'.")
|
||||||
|
|
||||||
cpe.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
archivePath: warArchiveName,
|
archivePath: warArchiveName,
|
||||||
deployMode: 'warParams',
|
deployMode: 'warParams',
|
||||||
@ -469,7 +386,7 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void deployHostProvidedAsDeprecatedParameterTest() {
|
void deployHostProvidedAsDeprecatedParameterTest() {
|
||||||
new File(workspacePath, archiveName) << "dummy archive"
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'configPropsUser123')
|
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'configPropsUser123')
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
@ -482,7 +399,7 @@ class NeoDeploymentTest extends BasePipelineTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void deployAccountProvidedAsDeprecatedParameterTest() {
|
void deployAccountProvidedAsDeprecatedParameterTest() {
|
||||||
new File(workspacePath, archiveName) << "dummy archive"
|
|
||||||
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'configPropsUser123')
|
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'configPropsUser123')
|
||||||
|
|
||||||
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
|
||||||
|
Loading…
Reference in New Issue
Block a user