kitchen verify fails to copy files

I hit an issue  last week when trying to run kitchen verify where I received the following error:

>>>>>> ——Exception——-
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Failed to complete #verify action: [Invalid argument @ dir_s_mkdir – C:/Users/rschi/AppData/Local/Temp/acme-win-webdefault-nano-sandbox-20170619-7672-1f5jk28/D:] on acme-win-webdefault-nano

Notice the “/D:” at the end of the “dir_s_mkdir” argument value. Very weird! 

I knew the cookbook and integration tests had all been working so it must be some environmental issue with my development machine.  I had run verify successfully on this machine as well so it had to be a recent change.

Root Cause

Not sure how but I eventually found the Github issue which was very similar:

https://github.com/test-kitchen/test-kitchen/issues/1190

Apparently, when you navigate to the cookbook in your console using a different casing Windows doesn’t care but Kitchen/Pester have code that does. 

image

Solved!

The solution was easy enough, just swap the match string with a Regex and specify to ignore case in the sandboxify_path method of the Pester.rb file.

def sandboxify_path(path)
    File.join(sandbox_path, path.sub(“#{suite_test_folder}/”, “”))
end

def sandboxify_path(path)
    File.join(sandbox_path, path.sub(/#{suite_test_folder}\//i, “”))
end

So, I pulled the source, added a unit test, fixed the bug and submitted a pull request. 

https://github.com/test-kitchen/kitchen-pester/pull/26

Workaround

Until my PR is accepted and you get the new version with the fix, the workaround is super simple, just fix your console path to match the real case of the directories.

image

If you also had this error and/or found this post useful please leave a comment below.

Happy Testing!

Leave a Reply