diff --git a/test/groovy/MTABuildTest.groovy b/test/groovy/MTABuildTest.groovy index 9c20aa8a8..abc0bc690 100644 --- a/test/groovy/MTABuildTest.groovy +++ b/test/groovy/MTABuildTest.groovy @@ -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") diff --git a/vars/mtaBuild.groovy b/vars/mtaBuild.groovy index 7e9aff071..ccaaad2ca 100644 --- a/vars/mtaBuild.groovy +++ b/vars/mtaBuild.groovy @@ -20,7 +20,7 @@ def call(Map parameters = [:]) { def mtaYaml = readYaml file: "${pwd()}/mta.yaml" //[Q]: Why not yaml.dump()? [A]: This reformats the whole file. - sh "sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ${pwd()}/mta.yaml" + sh "sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" \"${pwd()}/mta.yaml\"" def id = mtaYaml.ID if (!id) {