Running test-kitchen in Windows WSL with Hyper-V returns:
Traceback (most recent call last):
29: from /usr/bin/kitchen:352:in `<main>'
28: from /usr/bin/kitchen:352:in `load'
27: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/bin/kitchen:13:in `<top (required)>'
26: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/errors.rb:171:in `with_friendly_errors'
25: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/bin/kitchen:13:in `block in <top (required)>'
24: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
23: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
22: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
21: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
20: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/cli.rb:198:in `block (2 levels) in <class:CLI>'
19: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/cli.rb:52:in `perform'
18: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/command/action.rb:34:in `call'
17: from /opt/chefdk/embedded/lib/ruby/2.6.0/benchmark.rb:293:in `measure'
16: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/command/action.rb:35:in `block in call'
15: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/command.rb:142:in `parse_subcommand'
14: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/command.rb:112:in `filtered_instances'
13: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/config.rb:117:in `instances'
12: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/config.rb:143:in `build_instances'
11: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/config.rb:143:in `with_index'
10: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/config.rb:143:in `map'
9: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/config.rb:144:in `block in build_instances'
8: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/config.rb:248:in `new_instance'
7: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/config.rb:248:in `new'
6: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/instance.rb:107:in `initialize'
5: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/test-kitchen-2.5.2/lib/kitchen/instance.rb:331:in `setup_driver'
4: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/kitchen-vagrant-1.6.1/lib/kitchen/driver/vagrant.rb:178:in `finalize_config!'
3: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/kitchen-vagrant-1.6.1/lib/kitchen/driver/vagrant.rb:364:in `finalize_network!'
2: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/kitchen-vagrant-1.6.1/lib/kitchen/driver/helpers.rb:89:in `hyperv_switch'
1: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/kitchen-vagrant-1.6.1/lib/kitchen/driver/helpers.rb:70:in `run_ps'
/opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/kitchen-vagrant-1.6.1/lib/kitchen/driver/helpers.rb:78:in `execute_command': Failed: /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/mixlib-shellout-3.0.9/lib/mixlib/shellout/unix.rb:343: warning: Insecure world writable dir /mnt/c/Program Files/AdoptOpenJDK/jre-8.0.222.10-hotspot/bin in PATH, mode 040777 (RuntimeError)
sh: 1: c:windowssysnativewindowspowershellv1.0powershell.exe: not found
@doxinho could you run this with additional logging and include the log files? It would also be helpful if you could include your kitchen.yml content for this setup.
:ghost: Brief Description
Running test-kitchen in Windows WSL with Hyper-V returns:
Version
1.6.1
Environment
Windows 10 v2004, standard linux cookbook
Scenario
Trying to run test-kitchen within WSL using Hyper-V with vagrant, but it fails to find powershell.exe? I believe the issue is with this line? https://github.com/test-kitchen/kitchen-vagrant/blob/c44be7925fb5e178cec9ba9950aae0ed8d1476dc/lib/kitchen/driver/helpers.rb#L44
Steps to Reproduce
Install Hyper-V:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Install WSL:Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Install chefdk & vagrant in wsl:curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chefdk -c stable
&https://releases.hashicorp.com/vagrant/
Enable vagrant in WSL:export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"
Allow chef to use the embedded ruby installation instead of anything native:sudo ln -s /opt/chefdk /opt/chef
&export PATH=/opt/chef/embedded/bin:$PATH'
Configure vagrant to utilize Hyper-V:export VAGRANT_DEFAULT_PROVIDER=hyperv
Expected Result
test-kitchen runs successfully and spins up a Hyper-V VM
Actual Result
Fails immediately due to not finding powershell.exe