jenkins-spock icon indicating copy to clipboard operation
jenkins-spock copied to clipboard

getSharedLibraryVariables doesn't handle paths with spaces.

Open camara-tech opened this issue 4 years ago • 1 comments

Expected Behavior

When Running the tests for the Shared Library example from a path that contains a space in it, then all the tests should pass.

Actual Behavior

Those tests for verifying "Deployer.call" all fail with

DefaultPipelineSpec > Attempts to deploy MASTER branch to PRODUCTION FAILED
    java.lang.IllegalStateException: There is no pipeline step mock for [Deployer.call].
        1. Is the name correct?
        2. Does the pipeline step have a descriptor with that name?
        3. Does that step come from a plugin? If so, is that plugin listed as a dependency in your pom.xml?
        4. If not, you may need to call explicitlyMockPipelineStep('Deployer.call') in your test's setup: block.
        at com.homeaway.devtools.jenkins.testing.JenkinsPipelineSpecification.getPipelineMock(JenkinsPipelineSpecification.groovy:803)
        at DefaultPipelineSpec.Attempts to deploy MASTER branch to PRODUCTION(DefaultPipelineSpec.groovy:39)

DefaultPipelineSpec > Does NOT attempt to deploy non-MASTER branch PRODUCTION FAILED
    java.lang.IllegalStateException: There is no pipeline step mock for [Deployer.call].
        1. Is the name correct?
        2. Does the pipeline step have a descriptor with that name?
        3. Does that step come from a plugin? If so, is that plugin listed as a dependency in your pom.xml?
        4. If not, you may need to call explicitlyMockPipelineStep('Deployer.call') in your test's setup: block.
        at com.homeaway.devtools.jenkins.testing.JenkinsPipelineSpecification.getPipelineMock(JenkinsPipelineSpecification.groovy:803)
        at DefaultPipelineSpec.Does NOT attempt to deploy non-MASTER branch PRODUCTION(DefaultPipelineSpec.groovy:48)

Steps to Reproduce

  1. checkout the jenkins-spock repository to a folder with a space in it (e.g. /home/user/source code/jenkins-spock)
  2. Run the tests in the shared library example

Additional Information

Based on some debugging that I did, the path that is being used in getSharedLibraryVariables contains url-encoded spaces (e.g. "%20"). The File object does not handle decoding them and returns null as expected, leading to this behavior.

camara-tech avatar May 21 '21 13:05 camara-tech

Could you share line numbers of the locations where the File object's taking in a path with url encoding?

awittha avatar Aug 17 '21 16:08 awittha