1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

Use regex for asserting sed command

instead of having two checks, one for the first part of the command and one for asserting
the trailing file name at the end of the command.
This commit is contained in:
Marcus Holl 2017-11-13 10:11:56 +01:00
parent 9d61638eb4
commit 7f36ca0f74

View File

@ -84,8 +84,7 @@ public class MTABuildTest extends BasePipelineTest {
def script = loadScript(pipeline)
def mtarFilePath = script.execute()
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
assert shellCalls[0].endsWith('/mta.yaml"')
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/mta.yaml"$/
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")
@ -108,8 +107,7 @@ public class MTABuildTest extends BasePipelineTest {
def script = loadScript(pipeline)
def mtarFilePath = script.execute()
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
assert shellCalls[0].endsWith('/mta.yaml"')
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/mta.yaml"$/
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")
@ -134,8 +132,7 @@ public class MTABuildTest extends BasePipelineTest {
def script = loadScript(pipeline)
def mtarFilePath = script.execute(newDirName)
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
assert shellCalls[0].endsWith('/mta.yaml"')
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/newDir\/mta.yaml"$/
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")
@ -155,8 +152,7 @@ public class MTABuildTest extends BasePipelineTest {
def script = loadScript(pipeline)
def mtarFilePath = script.execute()
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
assert shellCalls[0].endsWith('/mta.yaml"')
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/mta.yaml"$/
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")
@ -177,8 +173,7 @@ public class MTABuildTest extends BasePipelineTest {
def script = loadScript(pipeline)
def mtarFilePath = script.execute()
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
assert shellCalls[0].endsWith('/mta.yaml"')
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/mta.yaml"$/
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")