Windows – Test Kitchen not detecting winrm and uses SSH for windows guest

cheftest-kitchenvagrantwindows

I'm new to test kitchen with windows

I'm testing chef recipes on a windows machine using Test Kitchen with Vagrant (virtualbox)

I have win-2012-r2 box that works fine with Vagrant (both winrm and rdp works)

But, when using the same with kitchen, it tries to connect SSH instead of winrm

Here is my .kitchen.yml file

---
driver:
  name: vagrant

provisioner:
  name: chef_zero

verifier:
  name: inspec

transport:
  name: winrm
  elevated: true

platforms:
  - name: win-2012-r2
    driver:
      box: win-2012-r2
      communicator: 'winrm'
      winrm_username: 'admin'
      winrm_password: 'adminadmin'

suites:
  - name: default
    run_list:
      - recipe[ttest::default]

While running kitchen test, the output is

-----> Starting Kitchen (v1.11.1)
-----> Cleaning up any prior instances of <default-win-2012-r2>
-----> Destroying <default-win-2012-r2>...
       Finished destroying <default-win-2012-r2> (0m0.00s).
-----> Testing <default-win-2012-r2>
-----> Creating <default-win-2012-r2>...
       Bringing machine 'default' up with 'virtualbox' provider...
       ==> default: Importing base box 'win-2012-r2'...
==> default: Matching MAC address for NAT networking...
       ==> default: Setting the name of the VM: kitchen-ttest-default-win-2012-r2_default_1472129655910_94157
       ==> default: Clearing any previously set network interfaces...
       ==> default: Preparing network interfaces based on configuration...
           default: Adapter 1: nat
       ==> default: Forwarding ports...
           default: 22 (guest) => 2222 (host) (adapter 1)
       ==> default: Booting VM...
       ==> default: Waiting for machine to boot. This may take a few minutes...
           default: SSH address: 127.0.0.1:2222
           default: SSH username: vagrant
           default: SSH auth method: private key
......................
STDERR: Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

Not sure where I'm missing.

Test Kitchen version 1.11.1
Vagrant 1.8.5
VirtualBox 5.1

Thanks you all

Best Answer

Try setting the port to 5985 (or whatever port you need.
For example:

platforms: - name: windows2016 transport: name: winrm elevated: true port: 5985

If this doesn't work try kitchen converge -l debug and get some more info on why the machine timed out.