Open mdealer opened 1 year ago
Proper Unicode handling and mock of the step.
It does not mock the step.
The bat step in question is roughly: output = script.bat script: '@echo off && aaa aaaaaaaaa aaaaaaaaaaaaaaaaa@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa', returnStdout: true, encoding: 'UTF-8', label: 'Batch Script (💻myhostname)'
output = script.bat script: '@echo off && aaa aaaaaaaaa aaaaaaaaaaaaaaaaa@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa', returnStdout: true, encoding: 'UTF-8', label: 'Batch Script (💻myhostname)'
The setup function / test class is roughly: import com.homeaway.devtools.jenkins.testing.JenkinsPipelineSpecification
class createBuilderSpec extends JenkinsPipelineSpecification { def setup() { // ... getPipelineMock('bat')([returnStdout: true, script: 'hostname']) >> 'myhostname' // Some other step which just works fine getPipelineMock("bat")([script:'@echo off && aaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa', returnStdout:true, encoding:'UTF-8', label:'Batch Script (💻myhostname)']) >> 'someresult' // ... } // ...
Spock does not handle the Unicode character, I can see it in the console:
10:11:07.598 [main] DEBUG com.homeaway.devtools.jenkins.testing.JenkinsPipelineSpecification - TEST FIXTURE intercepted & redirected a call: Test : class com.homeaway.devtools.jenkins.testing.JenkinsPipelineSpecification Note : pipeline step Via : createBuilder@4cb773c5.methodMissing (types) : createBuilder.methodMissing Invocation : createBuilder@4cb773c5.bat([[script:@echo off && aaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa, returnStdout:true, encoding:UTF-8, label:Batch Script (ƒÆ╗myhostname)]]) (types) : createBuilder.bat(Object[]) Forwarded To : Mock for type 'Closure' named 'getPipelineMock("bat")'.call([script:aaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa, returnStdout:true, encoding:UTF-8, label:Batch Script (ƒÆ╗myhostname)]) (types) : Closure$$EnhancerByCGLIB$$923b74da.call(LinkedHashMap)
As long as the character is in there, the mock is not actually called and the 'bat' step returns null.
I'm on Windows with Java 11 64-bit and Groovy 2.4.12.
Having Unicode in Strings works fine in Jenkins.
Expected Behavior
Proper Unicode handling and mock of the step.
Actual Behavior
It does not mock the step.
Steps to Reproduce
Additional Information
The bat step in question is roughly:
output = script.bat script: '@echo off && aaa aaaaaaaaa aaaaaaaaaaaaaaaaa@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa', returnStdout: true, encoding: 'UTF-8', label: 'Batch Script (💻myhostname)'
The setup function / test class is roughly: import com.homeaway.devtools.jenkins.testing.JenkinsPipelineSpecification
Spock does not handle the Unicode character, I can see it in the console:
As long as the character is in there, the mock is not actually called and the 'bat' step returns null.
I'm on Windows with Java 11 64-bit and Groovy 2.4.12.
Having Unicode in Strings works fine in Jenkins.