1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/test/groovy/MtaBuildTest.groovy

66 lines
1.9 KiB
Groovy
Raw Normal View History

import org.junit.Before
import org.junit.Ignore
2017-07-11 15:12:03 +02:00
import org.junit.Rule
import org.junit.Test
import org.junit.rules.ExpectedException
import org.junit.rules.RuleChain
import org.yaml.snakeyaml.parser.ParserException
import hudson.AbortException
import util.BasePiperTest
2018-09-04 11:32:54 +02:00
import util.JenkinsDockerExecuteRule
import util.JenkinsLoggingRule
import util.JenkinsReadYamlRule
2018-01-16 16:03:00 +02:00
import util.JenkinsShellCallRule
2018-02-28 14:12:03 +02:00
import util.JenkinsStepRule
import util.JenkinsWriteFileRule
import util.Rules
import static org.junit.Assert.assertThat
import static org.hamcrest.Matchers.containsString
import static org.hamcrest.Matchers.hasItem
public class MtaBuildTest extends BasePiperTest {
2018-02-21 13:48:14 +02:00
2019-01-22 10:25:42 +02:00
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
private JenkinsReadYamlRule readYamlRule = new JenkinsReadYamlRule(this)
2017-07-11 15:12:03 +02:00
@Rule
2018-02-28 14:12:03 +02:00
public RuleChain ruleChain = Rules
.getCommonRules(this)
2019-01-22 10:25:42 +02:00
.around(stepRule)
.around(readYamlRule)
@Test
void testCallGoWrapper() {
def calledWithParameters,
calledWithStepName,
calledWithMetadata,
calledWithCredentials
helper.registerAllowedMethod(
'piperExecuteBin',
[Map, String, String, List],
{
params, stepName, metaData, creds ->
calledWithParameters = params
calledWithStepName = stepName
calledWithMetadata = metaData
calledWithCredentials = creds
}
)
2018-04-17 17:35:10 +02:00
stepRule.step.mtaBuild(script: nullScript, buildTarget: 'CF')
2018-02-05 17:45:24 +02:00
assert calledWithParameters.size() == 2
assert calledWithParameters.script == nullScript
assert calledWithParameters.buildTarget == 'CF'
2018-02-05 17:45:24 +02:00
assert calledWithStepName == 'mtaBuild'
assert calledWithMetadata == 'metadata/mtaBuild.yaml'
assert calledWithCredentials.isEmpty()
}
2017-07-11 15:12:03 +02:00
}