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

Merge pull request #320 from marcusholl/pr/assertOrderOfGitCommands

Ensure the order of the git commands
This commit is contained in:
Marcus Holl 2018-10-09 16:51:47 +02:00 committed by GitHub
commit fd6a01a322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,7 @@ import static org.hamcrest.Matchers.hasItem
import static org.hamcrest.Matchers.hasItems
import static org.hamcrest.Matchers.not
import static org.hamcrest.Matchers.notNullValue
import static org.hamcrest.Matchers.stringContainsInOrder
import static org.hamcrest.Matchers.containsString
import static org.junit.Assert.assertThat
@ -90,10 +91,13 @@ class ArtifactSetVersionTest extends BasePiperTest {
assertEquals('testCommitId', jer.env.getGitCommitId())
assertThat(jscr.shell, hasItem("mvn --file 'pom.xml' --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn versions:set -DnewVersion=1.2.3-20180101010203_testCommitId -DgenerateBackupPoms=false"))
assertThat(jscr.shell, hasItems(containsString("git add ."),
containsString("git commit -m 'update version 1.2.3-20180101010203_testCommitId'"),
containsString('git tag build_1.2.3-20180101010203_testCommitId'),
containsString('git push myGitSshUrl build_1.2.3-20180101010203_testCommitId')))
assertThat(jscr.shell.join(), stringContainsInOrder([
"git add .",
"git commit -m 'update version 1.2.3-20180101010203_testCommitId'",
'git tag build_1.2.3-20180101010203_testCommitId',
'git push myGitSshUrl build_1.2.3-20180101010203_testCommitId',
]
))
}
@Test