Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows guests cannot use Gemfile with serverspec tests #616

Closed
robcoward opened this issue Feb 20, 2015 · 5 comments
Closed

Windows guests cannot use Gemfile with serverspec tests #616

robcoward opened this issue Feb 20, 2015 · 5 comments

Comments

@robcoward
Copy link

Busser-serverspec allows for an optional Gemfile to be provided in the [COOKBOOK]/test/integration/[SUITES]/serverspec/ directory. When this is used with a windows guest, it fails because it cannot find the bundle command.

-----> Starting Kitchen (v1.3.2.dev)
-----> Verifying <firewall-Windows2012>...
       Removing /tmp/busser/suites/serverspec
-----> Running serverspec test suite
-----> Bundle Installing..
         run  bundle install --gemfile /tmp/busser/suites/serverspec/Gemfile --local || bundle install --gemfile /tmp/busser/suites/serverspec/Gemfile from "."
       C:/opscode/chef/embedded/bin/ruby.exe -IC:/tmp/busser/suites/serverspec -I'C:/tmp/busser/gems/gems/rspec-support-3.2.1/lib';'C:/tmp/busser/gems/gems/rspec-core-3.2.0/lib' 'C:/tmp/busser/gems/gems/rspec-core-3.2.0/exe/rspec' --pattern 'C:/tmp/busser/suites/serverspec/**/*_spec.rb' --color --format documentation --default-path C:/tmp/busser/suites/serverspec
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #verify action: [Transport WinRM exited (1) using shell [powershell] for command: [$env:BUSSER_ROOT="/tmp/busser"

$env:GEM_HOME="/tmp/busser/gems"

$env:GEM_PATH="/tmp/busser/gems"

$env:GEM_CACHE="/tmp/busser/gems/cache"

$env:PATH="$env:PATH;$env:systemdrive\opscode\chef\embedded\bin"


/tmp/busser/gems/bin/busser.bat test
]
REMOTE ERROR:
'bundle' is not recognized as an internal or external command,
operable program or batch file.
'bundle' is not recognized as an internal or external command,
operable program or batch file.
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- mixlib-shellout (LoadError)

I have checked the c:\opscode\chef\embedded\bin directory on the VM and both bundle and bundle.bat exist.

@fnichol
Copy link
Contributor

fnichol commented Mar 29, 2015

@robcoward Hi there, think you could re-try this with a current 1.4.0.beta* (or later) release? This may be resolved now that Busser's commands are issued a little differently. Thanks!

@gh2k
Copy link

gh2k commented Apr 23, 2015

@fnichol I'm getting a similar problem with rc1:

-> bundle exec kitchen verify default-opentable-win-2012r2-standard-amd64-nocm
-----> Starting Kitchen (v1.4.0.rc.1)
-----> Verifying <default-opentable-win-2012r2-standard-amd64-nocm>...
       Preparing files for transfer
-----> Busser installation detected (busser)
       Installing Busser plugins: busser-serverspec
       Plugin serverspec already installed
       Removing C:/Users/vagrant/AppData/Local/Temp/verifier/suites/serverspec
       Transferring files to <default-opentable-win-2012r2-standard-amd64-nocm>
-----> Running serverspec test suite
-----> Bundle Installing..
         run  bundle install --gemfile C:/Users/vagrant/AppData/Local/Temp/verifier/suites/serverspec/Gemfile --local || bundle install --gemfile C:/Users/vagrant/AppData/Local/Temp/verifier/suites/serverspec/Gemfile from "."
       C:/opscode/chef/embedded/bin/ruby.exe -IC:/Users/vagrant/AppData/Local/Temp/verifier/suites/serverspec -I'C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-support-3.2.2/lib';'C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-core-3.2.3/lib' 'C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-core-3.2.3/exe/rspec' --pattern 'C:/Users/vagrant/AppData/Local/Temp/verifier/suites/serverspec/**/*_spec.rb' --color --format documentation --default-path C:/Users/vagrant/AppData/Local/Temp/verifier/suites/serverspec
$$$$$$ C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/busser-serverspec-0.5.5/lib/busser/runner_plugin/serverspec.rb:49:in `run_bundle_install': Use RbConfig instead of obsolete and deprecated Config.
$$$$$$ C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/busser-serverspec-0.5.5/lib/busser/runner_plugin/serverspec.rb:49:in `run_bundle_install': Use RbConfig instead of obsolete and deprecated Config.
$$$$$$ '"C:\Users\vagrant\AppData\Local\Temp\verifier\gems\bin\ruby.exe"' is not recognized as an internal or external command,
$$$$$$ operable program or batch file.
$$$$$$ '"C:\Users\vagrant\AppData\Local\Temp\verifier\gems\bin\ruby.exe"' is not recognized as an internal or external command,
$$$$$$ operable program or batch file.
$$$$$$ C:/Users/vagrant/AppData/Local/Temp/verifier/suites/serverspec/spec_helper.rb:17:in `<top (required)>': uninitialized constant Rspec (NameError)
$$$$$$  from C:/Users/vagrant/AppData/Local/Temp/verifier/suites/serverspec/default_spec.rb:1:in `require_relative'
$$$$$$  from C:/Users/vagrant/AppData/Local/Temp/verifier/suites/serverspec/default_spec.rb:1:in `<top (required)>'
$$$$$$  from C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `load'
$$$$$$  from C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `block in load_spec_files'
$$$$$$  from C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `each'
$$$$$$  from C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `load_spec_files'
$$$$$$  from C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:97:in `setup'
$$$$$$  from C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:85:in `run'
$$$$$$  from C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70:in `run'
$$$$$$  from C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38:in `invoke'
$$$$$$  from C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-core-3.2.3/exe/rspec:4:in `<main>'
$$$$$$ C:/opscode/chef/embedded/bin/ruby.exe -IC:/Users/vagrant/AppData/Local/Temp/verifier/suites/serverspec -I'C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-support-3.2.2/lib';'C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-core-3.2.3/lib' 'C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/rspec-core-3.2.3/exe/rspec' --pattern 'C:/Users/vagrant/AppData/Local/Temp/verifier/suites/serverspec/**/*_spec.rb' --color --format documentation --default-path C:/Users/vagrant/AppData/Local/Temp/verifier/suites/serverspec failed
$$$$$$ !!!!!! Ruby Script [C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/busser-serverspec-0.5.5/lib/busser/runner_plugin/../serverspec/runner.rb C:/Users/vagrant/AppData/Local/Temp/verifier/suites/serverspec] exit code was 1
>>>>>> Verify failed on instance <default-opentable-win-2012r2-standard-amd64-nocm>.
>>>>>> Please see .kitchen/logs/default-opentable-win-2012r2-standard-amd64-nocm.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: WinRM exited (1) for command: [
$env:BUSSER_ROOT = "$env:TEMP\verifier"
$env:GEM_HOME = "$env:TEMP\verifier\gems"
$env:GEM_PATH = "$env:TEMP\verifier\gems"
$env:GEM_CACHE = "$env:TEMP\verifier\gems\cache"

& $env:TEMP\verifier\bin\busser.bat test
]
>>>>>> ----------------------

It looks like the binstubs in %APPDATA%\Local\Temp\verifier\gems\bin don't point at a valid ruby executable:

C:\Users\vagrant>more C:\Users\vagrant\AppData\Local\Temp\verifier\gems\bin\bundle.bat                                                                                                                                               
@ECHO OFF                                                                                                                                                                                                                            
IF NOT "%~f0" == "~f0" GOTO :WinNT                                                                                                                                                                                                   
@"C:\Users\vagrant\AppData\Local\Temp\verifier\gems\bin\ruby.exe" "C:/Users/vagrant/AppData/Local/Temp/verifier/gems/bin/bundle" %1 %2 %3 %4 %5 %6 %7 %8 %9                                                                          
GOTO :EOF                                                                                                                                                                                                                            
:WinNT                                                                                                                                                                                                                               
@"%~dp0ruby.exe" "%~dpn0" %*                         

vs.

C:\Users\vagrant>more C:\Users\vagrant\AppData\Local\Temp\verifier\gems\bin\bundle                                                                                                                                                   
#!C:/opscode/chef/embedded/bin/ruby.exe                                                                                                                                                                                              
#                                                                                                                                                                                                                                    
# This file was generated by RubyGems.                                                                                                                                                                                               
#                                                                    
....

The latter is the ruby that actually exists.

@robcoward did you get anywhere with this?

@d-higuchi
Copy link

i released busser-serverspec v0.5.6. thank you @gh2k for pull-req.
but i think this is workaround, need to fix binstubs's path.

@gh2k
Copy link

gh2k commented Apr 27, 2015

I've re-raised this issue (WRT binstubs) as test-kitchen/busser#25 as I think that's a better place to put it, and the symptoms of the bug as described here no longer occur.

@tyler-ball
Copy link
Contributor

I'm going to close this because the remaining issue is tracked in test-kitchen/busser#25

@test-kitchen test-kitchen locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants