Giter VIP home page Giter VIP logo

kitchen-verifier-serverspec's Introduction

Gem Version Gem Downloads Build Status

Kitchen::Verifier::Serverspec

A Test Kitchen Serverspec Verifer without having to transit the Busser layer.

This supports running serverspec both remotely on the server and locally on your workstation. Runners are supported to provide logic to run serverspec initially supporting ansiblespec.

Installation

On your workstation add this line to your Gemfile:

gem 'kitchen-verifier-serverspec'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kitchen-verifier-serverspec

When it runs it install serverspec on the remote server or the workstation if remote_exec set to false. This can be configured by passing a Gemfile like this:

source 'https://rubygems.org'

gem 'net-ssh','~> 2.9'
gem 'serverspec'

this allows extra dependencies to be specified and the version of serverspec specified.

Serverspec Verifier Options

key default value Notes
additional_install_commmand nil Additional shell command to be used at install stage. Can be multiline. See examples below.
additional_serverspec_command nil additional command to run serverspec. Can be multiline. See examples below.
bundler_path override path for bundler command
color true enable color in the output
custom_install_commmand nil Custom shell command to be used at install stage. Can be multiline. See examples below.
custom_serverspec_command nil custom command to run serverspec. Can be multiline. See examples below.
default_path '/tmp/kitchen' Set the default path where serverspec looks for patterns
default_pattern false use default dir behaviour of busser i.e. test/integration/SUIT_NAME/serverspec/*_spec.rb
env_vars {} environment variable to set for rspec and can be used in the spec_helper. It will automatically pickup any environment variables set with a KITCHEN_ prefix.
extra_flags nil extra flags to add to ther serverspec command
format 'documentation' format of serverspec output
gemfile nil custom gemfile to use to install serverspec
http_proxy nil use http proxy when installing ruby, serverspec and running serverspec
https_proxy nil use https proxy when installing puppet, ruby, serverspec and running serverspec
patterns [] array of patterns for spec test files
remote_exec true specify false to run serverspec on workstation
remove_default_path false remove the default_path after successful serverspec run
require_runner false run the custom runner instead of rspec directly
rspec_path override path for rspec command
runner_url https://raw.githubusercontent.com /neillturner/serverspec-runners/ master/ansiblespec_runner.rb url for custom runner
sleep 0
sudo nil use sudo to run commands
sudo_command 'sudo -E -H' sudo command to run when sudo set to true
test_serverspec_installed true only run install_command if serverspec not installed

Tips

If you get errors like 'Bundler installed as root, can't be found' then you will need to set the paths. Its hard to get the default paths correct when ruby maybe installed in a different user.

bundler_path: '/usr/local/bin'
rspec_path: '/usr/local/bin'

Usage

There are three ways to run verifier serverspec:

  • Remotely directly on the server running serverspec in exec mode
  • Remotely directly on the server running serverspec in ssh mode
  • Locally on your workstation running serverspec in ssh mode

Verifier Serverspec allows the serverspec files to be anywhere in the repository or in the test-kitchen default location i.e /test/integration. This means that you can use spec files that follow ansiblespec or puppet beaker locations.

Windows

A good example of using severspec wit windows can be found at:

Spec File Location and Updating

When remote_exec is set to true (the default) the following rules apply for getting the spec files to the remote server instance.

if default_pattern is set to true then Verifier Serverspec copies the spec files in the test/integration directory like the busser serverspec that is supplied by chef.

if default_pattern is set to false (the default) then Verfier Serverspec does not copy the the serverspec files. They are assumed to be there in the repository and to have been copied to the server via the provisioner. This means in this case if you change a spec file you need to run converge again to get the spec files copied to the server. A future enhancement maybe to copy these files so the provisioner doesn't have to be called when they are changed.

Remotely directly on server running serverspec in exec mode

This allow testing directly on the server. Typicaly used in conjunction with ansible using local connection.

An example of the verifier serverspec options in your .kitchen.yml file:

verifier:
  name: serverspec

suites:
  - name: base
    verifier:
      patterns:
      - modules/mycompany_base/spec/acceptance/base_spec.rb

See example https://github.com/neillturner/puppet_repo

verifier:
  name: serverspec

suites:
  - name: base
    verifier:
      patterns:
      - roles/tomcat/spec/tomcat_spec.rb
      bundler_path: '/usr/local/bin'
      rspec_path: '/usr/local/bin'

See example https://github.com/neillturner/ansible_repo

The spec/spec_helper.rb should contain

require 'serverspec'
set :backend, :exec

Remotely directly on the server running serverspec in ssh mode

This allow testing of multiple remote servers. Typicaly used in conjunction with ansible using ssh connection.

verifier:
  name: serverspec

suites:
  - name: base
    verifier:
      patterns:
      - roles/tomcat/spec/tomcat_spec.rb
      bundler_path: '/usr/local/bin'
      rspec_path: '/home/vagrant/bin'
      env_vars:
        TARGET_HOST: 172.28.128.7
        LOGIN_USER: vagrant
        SSH_KEY: 'spec/tomcat_private_key.pem'

The spec/spec_helper.rb should contain

require 'rubygems'
require 'bundler/setup'

require 'serverspec'
require 'pathname'
require 'net/ssh'

RSpec.configure do |config|
  set :host,  ENV['TARGET_HOST']
  # ssh options at http://net-ssh.github.io/ssh/v1/chapter-2.html
  # ssh via password, set :version to :debug for debugging
  #set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :info, :password => ENV['LOGIN_PASSWORD'] if ENV['LOGIN_PASSWORD']
  # ssh via ssh key
  set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :error, :host_key => 'ssh-rsa', :keys => [ ENV['SSH_KEY'] ] if ENV['SSH_KEY']
  set :backend, :ssh
  set :request_pty, true
end

Locally on your workstation running serverspec in ssh mode

This allows you not to have to install ruby and serverspec on the server being configured as serverspec is run on your workstation in ssh mode.

verifier:
  name: serverspec
  remote_exec: false

suites:
  - name: base
    provisioner:
      custom_facts:
        role_name1: base
    verifier:
      patterns:
      - modules_mycompany/mycompany_base/spec/acceptance/base_local_spec.rb

Set environment variables dynamically on your workstation

export KITCHEN_HOST=127.0.0.1
export KITCHEN_PORT=2222
export KITCHEN_USERNAME=vagrant
export KITCHEN_SSH_KEY='c:/repository/puppet_repo/private_key.pem'
Or for Windows Workstations:
set KITCHEN_HOST=127.0.0.1
set KITCHEN_PORT=2222
set KITCHEN_USERNAME=vagrant
set KITCHEN_SSH_KEY='c:/repository/puppet_repo/private_key.pem'

The spec/spec_helper.rb should contain

require 'rubygems'
require 'bundler/setup'

require 'serverspec'
require 'pathname'
require 'net/ssh'

RSpec.configure do |config|
  set :host, ENV['KITCHEN_HOSTNAME']
  # ssh options at http://net-ssh.github.io/net-ssh/Net/SSH.html#method-c-start
  # ssh via ssh key (only)
  set :ssh_options,
    :user => ENV['KITCHEN_USERNAME'],
    :port => ENV['KITCHEN_PORT'],
    :auth_methods => [ 'publickey' ],
    :keys => [ ENV['KITCHEN_SSH_KEY'] ],
    :keys_only => true,
    :paranoid => false,
    :verbose => :error
  set :backend, :ssh
  set :request_pty, true
end

Custom Runners

Custon runners can be defined and run to provide further customization. There is a runner that automatically runs the ansiblespec files for all the hosts from the ansible provisioner.

This can be run by specifying in the kitchen yml file:

verifier:
  name: serverspec

suites:
  - name: base
    verifier:
      runner_url: https://raw.githubusercontent.com/neillturner/serverspec-runners/master/ansiblespec_runner.rb
      require_runner: true
      bundler_path: '/usr/local/bin'
      rspec_path: '/home/vagrant/bin'
      env_vars:
        TARGET_HOST: 172.28.128.7
        LOGIN_USER: vagrant
        SSH_KEY: 'spec/tomcat_private_key.pem'

custom_install_command example usage

  • One liner
    custom_install_command: yum install -y git
  • Multiple lines, a.k.a embed shell script
  custom_install_command: |
     command1
     command2
  • Multiple lines join without new line
  custom_install_command: >
     command1 &&
     command2

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Run style checks and RSpec tests (bundle exec rake)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

kitchen-verifier-serverspec's People

Contributors

ahelal avatar alex-harvey-z3q avatar craigw avatar frozensolid avatar j4m3s avatar lilithfr avatar lirt avatar lomeroe avatar milky-milk avatar neillturner avatar timogoebel avatar wtanaka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

kitchen-verifier-serverspec's Issues

spec_helper.rb - confused with search locations.

I'm trying to get remote_exec: false mode to get working. I am using username/empty password login, so I had to modify spec_helper.rb. But I don't think spec files are picking it up correctly.

I'm probably doing something wrong. I would appreciate any kind of help.
I'm usingMacOS X.

I'm getting test failures for each test. like that:

File "/test-file1"
  should be file (FAILED - 1)

Failures:

  1) File "/test-file1" should be file
     On host `127.0.0.1'
     Failure/Error: it { should be_file }
       expected `File "/test-file1".file?` to return true, got false
       /bin/sh -c test\ -f\ /test-file1

     # ./test/integration/default/serverspec/touchtest_spec.rb:7:in `block (2 levels) in <top (required)>'
tree .
.
└── integration
    └── default
        └── serverspec
            ├── spec_helper.rb
            ├── ssh_spec.rb
            └── touchtest_spec.rb
# touchtest_spec.rb
require_relative 'spec_helper'
require 'serverspec'
set :backend, :exec
set :os, :family => 'linux'

describe file('/test-file1') do
  it { should be_file }
end
# spec_helper.rb
require 'rubygems'
require 'bundler/setup'

require 'serverspec'
require 'pathname'
require 'net/ssh'



RSpec.configure do |config|
  set :host, '127.0.0.1'
  # ssh options at http://net-ssh.github.io/net-ssh/Net/SSH.html#method-c-start
  # ssh via ssh key (only)
  set :ssh_options,
      :user => 'root',
      :password => '',
      :port => '2222',
      # :auth_methods => [ 'publickey', 'password' ],
      :paranoid => false,
      :verbose => :debug
  set :backend, :ssh
  set :request_pty, true
end
# ../kitchen.yml
---
driver:
  name: vagrant
  ssh:
    insert_key: false
    shell: '"/bin/sh"'

  # Ensure no synced directores are needed for caching
  disable_cache: true
  cache_directory:

  customize:
    cableconnected1: 'on'

verifier:
  name: serverspec
  remote_exec: false
  bundler_path: '/usr/local/bin'
  rspec_path: '/usr/local/bin'
  gemfile: Gemfile
  default_pattern: true

suites:
  - name: default

kitchen verify fails when using more than one pattern

Hello!

When I'm trying to define more than one pattern for serverspec, kitchen fails:
for expample:

suites:
  - name: Common
    provisioner:
      name: ansible_playbook
      playbook: test/integration/default.yml
    verifier:
      patterns:
      - roles/common/spec/common_spec.rb
      - roles/nginx/spec/nginx_spec.rb

fail message:

       Installing ruby, bundler and serverspec remotely on server
       Running Serverspec
       invalid option: -E

       Please use --help for a listing of valid options
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #verify action: [SSH exited (1) for command: [            source $HOME/.rvm/scripts/rvm
            if [ -d /tmp/kitchen ]; then
              cd /tmp/kitchen
               sudo -E rspec -c -f documentation --default-path  /tmp/kitchen  -P roles/common/spec/common_spec.rb\n sudo -E rspec -c -f documentation --default-path  /tmp/kitchen  -P roles/nginx/spec/nginx_spec.rb

            else
              echo "ERROR: Default path '/tmp/kitchen' does not exist"
              exit 1
            fi
]]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

It seems, the error causes #{s}" }.join('\n').

      def rspec_commands
        info('Running Serverspec')
        if config[:require_runner]
          "#{env_vars} #{sudo_env(rspec_cmd)} #{color} -f #{config[:format]} --default-path  #{config[:default_path]} #{rspec_path_option} #{config[:extra_flags]}"
        else
          config[:patterns].map { |s| "#{env_vars} #{sudo_env(rspec_cmd)} #{color} -f #{config[:format]} --default-path  #{config[:default_path]} #{config[:extra_flags]} -P #{s}" }.join('\n')
        end
      end

Maybe it should be more correct to use #{s}" }.join(';') to separate commands?

kitchen verify fails when using ubuntu/debian docker images with rvm

Hello!

I'm trying to use custom Ubuntu and Debian Docker images with installed rvm (ruby 2.3) for kitchen user :

USER kitchen
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 \
    && /bin/bash -l -c "curl -L get.rvm.io | bash -s stable" \
    && /bin/bash -l -c "rvm install 2.3" \
    && /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" \
    && /bin/bash -l -c "gem install bundler --no-ri --no-rdoc" \
    && /bin/bash -l -c "gem install serverspec" \
    && /bin/bash -l -c "gem install rake" \
    && /bin/bash -l -c "gem install ansible_spec" \
    && echo 'source $HOME/.rvm/scripts/rvm' >> $HOME/.bashrc

When I'm trying to run kitchen verify it fails: http://upaste.me/32cc24597e5f5086a

However, rspec is installed and exist: http://upaste.me/d86824598be0de65c
And I can run test manually:

kitchen@2f92a59ec673:/tmp/kitchen$ rspec -c -f documentation --default-path  /tmp/kitchen  -P roles/common/spec/common_spec.rb

Package "curl" 
  should be installed

Finished in 0.07897 seconds (files took 0.9562 seconds to load)

It seems like verifier don't use user's $PATH or ignoring ~/.bashrc settings?
I've tried to use rspec_path setting in kitchen.yml but kitchen verify fails with error:
/usr/bin/env: ruby_executable_hooks: No such file or directory
There is the full output: http://upaste.me/8217245999e0fd72e

My kitchen.yml http://upaste.me/db0d246015ada65c2

What is intresting: same setup with CentOS-6.7 and rvm in Docker works fine when I run kitchen verify.

Cant you please tell me where I am wrong? Is it possible to use serverspec verifier with rvm?

JSON format not returned from rspec call due to SSH problems

Environment

Ruby 2.5.1
kitchen-ansible (0.50.1)
kitchen-docker (2.10.0)
kitchen-inspec (1.3.2)
kitchen-verifier-serverspec (0.7.0)
test-kitchen (2.5.1)

Test Environment

Ruby 2.5.1/Ruby 2.5.8
bundler 2.1.4
diff-lcs 1.3
multi_json 1.14.1
net-ssh 3.2.0
net-scp 3.0.0
net-telnet 0.1.1
rspec-support 3.9.3
rspec-core 3.9.2
rspec-expectations 3.9.2
rspec-mocks 3.9.1
rspec 3.9.0
rspec-its 1.3.0
sfl 2.3
specinfra 2.82.16
serverspec 2.41.5

Error message

>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Failed to complete #verify action: [SSH exited (1) for command: [            
            mkdir -p /tmp/kitchen
            cd /tmp/kitchen
            RSPEC_CMD=$(which rspec)
            echo "---> RSPEC_CMD variable is: ${RSPEC_CMD}"
             sudo -E -H  $RSPEC_CMD -c -f json --default-path  /tmp/kitchen  -P /tmp/verifier/suites/serverspec/*_spec.rb

Backtrace

D      ----------------------
D      ------Backtrace-------
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/transport/ssh.rb:143:in `execute'
D      /var/lib/gems/2.5.0/gems/kitchen-verifier-serverspec-0.7.0/lib/kitchen/verifier/serverspec.rb:69:in `block in call'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/transport/base.rb:100:in `initialize'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/transport/ssh.rb:121:in `initialize'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/transport/ssh.rb:551:in `new'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/transport/ssh.rb:551:in `create_new_connection'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/transport/ssh.rb:99:in `connection'
D      /var/lib/gems/2.5.0/gems/kitchen-verifier-serverspec-0.7.0/lib/kitchen/verifier/serverspec.rb:62:in `call'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/instance.rb:459:in `block in verify_action'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/instance.rb:552:in `synchronize_or_call'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/instance.rb:514:in `block in action'
D      /usr/lib/ruby/2.5.0/benchmark.rb:293:in `measure'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/instance.rb:513:in `action'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/instance.rb:451:in `verify_action'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/instance.rb:382:in `block (2 levels) in transition_to'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/lifecycle_hooks.rb:45:in `run_with_hooks'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/instance.rb:381:in `block in transition_to'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/instance.rb:380:in `each'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/instance.rb:380:in `transition_to'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/instance.rb:162:in `verify'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/command.rb:198:in `public_send'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/command.rb:198:in `run_action_in_thread'
D      /var/lib/gems/2.5.0/gems/test-kitchen-2.5.1/lib/kitchen/command.rb:169:in `block (2 levels) in run_action'
D      ----End Backtrace-----

Story
Our test automation system recently failed after upgrading from ruby 2.4.3 to ruby 2.5.1 (and now 2.5.8). When running the Verifier with format: json the kitchen verify call would never return any output. format: documentation seems to be fine. I cannot pinpoint the issue but the backtrace seems to suggest SSH problems.

Must env_vars be hardcoded into .kitchen.yml?

I'm using option 3: 'Locally on your workstation running serverspec in ssh mode'

At the start of a 'kitchen verify' run, test-kitchen knows the details of the instance it is testing, and outputs them to the terminal, e.g.

[Serverspec] Verify on instance=#<Kitchen::Instance:0x0000000280a2f8> with state={:hostname=>"127.0.0.1", :port=>"2222", :username=>"vagrant", :ssh_key=>

Can those connection details not be automatically be picked-up and used for the test suite, rather than having to hard-code them into the .kitchen.yml file as described in the README?:

      env_vars:
        TARGET_HOST: 127.0.0.1
        TARGET_PORT: 2222
        LOGIN_USER: vagrant
        SSH_KEY: 'c:/repository/puppet_repo/private_key.pem'

APT Ruby package does not provide /usr/bin/bundle

if [ ! $(which ruby) ]; then
echo '-----> Installing ruby, will try to determine platform os'
if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ] || [ -f /etc/oracle-release ]; then
#{sudo_env('yum')} -y install ruby
else
if [ -f /etc/system-release ] && grep -q 'Amazon Linux' /etc/system-release; then
#{sudo_env('yum')} -y install ruby
else
#{sudo_env('apt-get')} -y update
#{sudo_env('apt-get')} -y install ruby

Hello,
Under Debian11 and Ubuntu20.04, the kitchen test command fails on this file because apt-get install ruby installs ruby2.7 which provides /usr/bin/bundle2.7 and $(which bundle) returns nothing.

I fixed this problem by replacing ruby with ruby-bundler which provides the expected executable /usr/bin/bundle

$ apt-file search /usr/bin/bundle
ruby-bundler: /usr/bin/bundle
ruby-bundler: /usr/bin/bundler
ruby2.7: /usr/bin/bundle2.7
ruby2.7: /usr/bin/bundler2.7

remote_exec with non-default patterns

Hey guys, can't figure out how to use remote_exec with patterns option. It feels that it can only work with default_pattern. Only in this case the sandbox gets created and files are transferred to the remote box.

Here are more detail, let me know if this is valid point and if we might want to fix this

Here is transferring to the box with default_pattern, it means that we will have a sandbox-ed
https://github.com/neillturner/kitchen-verifier-serverspec/blob/master/lib/kitchen/verifier/serverspec.rb#L58-L71

Setting remote_exec=true, then default_pattern=false and using patterns won't do: no files will be transferred to the box.

If seems to be true, because method rspec_commands also heavily relies on default_pattern values producing a set of patterns via patterns and looking into default_path.

default_path is set to /tmp/kitchen/, it won't have any test suites. Feels that the only way to get files transferred to the box is setting default_pattern=true, they will end up in the sandbox-ed folder (nothing in /tmp/kitchen/) but "patterns" still look under /tmp/kitchen/

config[:patterns].map { |s| "#{env_vars} #{sudo_env('')} $RSPEC_CMD #{color} -f #{config[:format]} --default-path  #{config[:default_path]} #{config[:extra_flags]} -P #{s}" }.join(';')

https://github.com/neillturner/kitchen-verifier-serverspec/blob/master/lib/kitchen/verifier/serverspec.rb#L281-L297

Default pattern will make this call looking under

#{config[:root_path]}/suites/serverspec/*_spec.rb

https://github.com/neillturner/kitchen-verifier-serverspec/blob/master/lib/kitchen/verifier/serverspec.rb#L284

and then patterns will be looking into default_path! They find nothing

#{env_vars} #{sudo_env('')} $RSPEC_CMD #{color} -f #{config[:format]} --default-path  #{config[:default_path]} #{config[:extra_flags]} -P #{s}" 

https://github.com/neillturner/kitchen-verifier-serverspec/blob/master/lib/kitchen/verifier/serverspec.rb#L293

bundler2.0.0 requires ruby 2.3

On Amazon Linux 1 we have the problem, that the new bundler 2.0.0 requires ruby 2.3 but with the default installation is ruby 2.0.0.
This leads to an error in the verifier installation


       ================================================================================
        Package                 Arch      Version                   Repository    Size
       ================================================================================
       Installing:
        ruby                    noarch    1:2.0-0.3.amzn1           amzn-main    2.5 k
       Installing for dependencies:
        libyaml                 x86_64    0.1.6-6.7.amzn1           amzn-main     59 k
        ruby20                  x86_64    2.0.0.648-1.31.amzn1      amzn-main     69 k
        ruby20-irb              noarch    2.0.0.648-1.31.amzn1      amzn-main     90 k
        ruby20-libs             x86_64    2.0.0.648-1.31.amzn1      amzn-main    3.7 M
        rubygem20-bigdecimal    x86_64    1.2.0-1.31.amzn1          amzn-main     79 k
        rubygem20-json          x86_64    1.8.3-1.51.amzn1          amzn-main     69 k
        rubygem20-psych         x86_64    2.0.0-1.31.amzn1          amzn-main     78 k
        rubygem20-rdoc          noarch    4.2.2-1.43.amzn1          amzn-main    581 k
        rubygems20              noarch    2.0.14.1-1.31.amzn1       amzn-main    225 k

       Transaction Summary
       ================================================================================
       Install  1 Package (+9 Dependent packages)

       Total download size: 4.9 M
       Installed size: 13 M
       Downloading packages:
(1/10): libyaml-0.1.6-6.7.amzn1.x86_64.rpm                 |  59 kB   00:00
(2/10): ruby-2.0-0.3.amzn1.noarch.rpm                      | 2.5 kB   00:00
(3/10): ruby20-2.0.0.648-1.31.amzn1.x86_64.rpm             |  69 kB   00:00
(4/10): ruby20-irb-2.0.0.648-1.31.amzn1.noarch.rpm         |  90 kB   00:00
(5/10): rubygem20-bigdecimal-1.2.0-1.31.amzn1.x86_64.rpm   |  79 kB   00:00
(6/10): rubygem20-json-1.8.3-1.51.amzn1.x86_64.rpm         |  69 kB   00:00
(7/10): rubygem20-psych-2.0.0-1.31.amzn1.x86_64.rpm        |  78 kB   00:00
(8/10): rubygem20-rdoc-4.2.2-1.43.amzn1.noarch.rpm         | 581 kB   00:00
(9/10): ruby20-libs-2.0.0.648-1.31.amzn1.x86_64.rpm        | 3.7 MB   00:00
(10/10): rubygems20-2.0.14.1-1.31.amzn1.noarch.rpm         | 225 kB   00:00
       --------------------------------------------------------------------------------
       Total                                              8.5 MB/s | 4.9 MB  00:00
       Running transaction check
       Running transaction test
       Transaction test succeeded
       Running transaction
  Installing : ruby20-libs-2.0.0.648-1.31.amzn1.x86_64                     1/10
  Installing : libyaml-0.1.6-6.7.amzn1.x86_64                              2/10
  Installing : rubygem20-json-1.8.3-1.51.amzn1.x86_64                      3/10
  Installing : rubygem20-psych-2.0.0-1.31.amzn1.x86_64                     4/10
  Installing : ruby20-2.0.0.648-1.31.amzn1.x86_64                          5/10
  Installing : ruby20-irb-2.0.0.648-1.31.amzn1.noarch                      6/10
  Installing : rubygem20-bigdecimal-1.2.0-1.31.amzn1.x86_64                7/10
  Installing : rubygems20-2.0.14.1-1.31.amzn1.noarch                       8/10
  Installing : rubygem20-rdoc-4.2.2-1.43.amzn1.noarch                      9/10
  Installing : 1:ruby-2.0-0.3.amzn1.noarch                                10/10
  Verifying  : ruby20-irb-2.0.0.648-1.31.amzn1.noarch                      1/10
  Verifying  : rubygem20-rdoc-4.2.2-1.43.amzn1.noarch                      2/10
  Verifying  : rubygem20-json-1.8.3-1.51.amzn1.x86_64                      3/10
  Verifying  : rubygems20-2.0.14.1-1.31.amzn1.noarch                       4/10
  Verifying  : ruby20-libs-2.0.0.648-1.31.amzn1.x86_64                     5/10
  Verifying  : 1:ruby-2.0-0.3.amzn1.noarch                                 6/10
  Verifying  : rubygem20-psych-2.0.0-1.31.amzn1.x86_64                     7/10
  Verifying  : ruby20-2.0.0.648-1.31.amzn1.x86_64                          8/10
  Verifying  : libyaml-0.1.6-6.7.amzn1.x86_64                              9/10
  Verifying  : rubygem20-bigdecimal-1.2.0-1.31.amzn1.x86_64               10/10

       Installed:
         ruby.noarch 1:2.0-0.3.amzn1

       Dependency Installed:
         libyaml.x86_64 0:0.1.6-6.7.amzn1
         ruby20.x86_64 0:2.0.0.648-1.31.amzn1
         ruby20-irb.noarch 0:2.0.0.648-1.31.amzn1
         ruby20-libs.x86_64 0:2.0.0.648-1.31.amzn1
         rubygem20-bigdecimal.x86_64 0:1.2.0-1.31.amzn1
         rubygem20-json.x86_64 0:1.8.3-1.51.amzn1
         rubygem20-psych.x86_64 0:2.0.0-1.31.amzn1
         rubygem20-rdoc.noarch 0:4.2.2-1.43.amzn1
         rubygems20.noarch 0:2.0.14.1-1.31.amzn1

       Complete!
Fetching: bundler-2.0.0.gem (100%)
       ERROR:  Error installing bundler:
        bundler requires Ruby version >= 2.3.0.
       which: no bundle in (/usr/local/bin:/bin:/usr/bin)
       ---> BUNDLE_CMD variable is:
       install: unrecognized option '--gemfile=/tmp/kitchen/Gemfile'
       Try 'install --help' for more information.
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Failed to complete #verify action: [SSH exited (1) for command: [
            if [ ! $(which ruby) ]; then
              echo '-----> Installing ruby, will try to determine platform os'
              if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ] || [ -f /etc/oracle-release ]; then
                sudo -E -H yum -y install ruby
              else
                if [ -f /etc/system-release ] && grep -q 'Amazon Linux' /etc/system-release; then
                  sudo -E -H yum -y install ruby
                else
                  sudo -E -H apt-get -y update
                  sudo -E -H apt-get -y install ruby
                fi
              fi
            fi
                        if [ "$(sudo -E -H gem list bundler -i)" = "true" ]; then
              echo "Bundler already installed"
            else
              if [ "$(sudo -E -H gem list bundler -i)" = "false" ]; then
                sudo -E -H gem install  --no-ri --no-rdoc bundler
              else
                echo "ERROR: Ruby not installed correctly"
                exit 1
              fi
            fi

            if [ -d /tmp/kitchen ]; then
                            if [ "$(sudo -E -H gem list serverspec -i)" = "false" ]; then
                        sudo -E -H rm -f /tmp/kitchen/Gemfile
          sudo -E -H echo "source 'https://rubygems.org'" >> /tmp/kitchen/Gemfile
          sudo -E -H echo "gem 'net-ssh','~> 2.9'"  >> /tmp/kitchen/Gemfile
          sudo -E -H echo "gem 'serverspec'" >> /tmp/kitchen/Gemfile

              BUNDLE_CMD=$(which bundle)
              echo "---> BUNDLE_CMD variable is: ${BUNDLE_CMD}"
              sudo -E -H  $BUNDLE_CMD install --gemfile=/tmp/kitchen/Gemfile
            fi


            else
              echo "ERROR: Default path '/tmp/kitchen' does not exist"
              exit 1
            fi
]] on default-amazonlinux
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

Windows verify

Hi Neil,

Could you post an example for testing with Windows systems? From what I have found they need a slightly different spec_helper.rb:

require 'serverspec'
require 'winrm'

set :backend, :winrm
set :os, :family => 'windows'

user = vagrant
pass = vagrant
endpoint = "http://#{ENV['TARGET_HOST']}:5985/wsman"

winrm = ::WinRM::WinRMWebService.new(endpoint, :ssl, :user => user, :pass => pass, :basic_auth_only => true)
winrm.set_timeout 300 # 5 minutes max timeout for any operation
Specinfra.configuration.winrm = winrm

kitchen verify finishes with 0 examples, 0 failures for serverspec tests while testing ansible role with docker as driver

I am working to test ansible playbook or roles with test-kitchen using kitchen-ansible,serverspec for testing of playbooks with docker driver on a redhat 6.6 server( workstation). I can able to run kitchen convergence successfully.While running kitchen verify, it was unable to find my test cases and returning the below response. i am not sure why it is not picking up my test cases and running.
I have playbook default.yml and it calls the role splunk and the main.yml in splunk role will create the directory called splunk in /opt folder of the test server. and the test_spec.rb will check if it is directory or not.

Kitchen converge is running the playbook and created the splunk folder in the docker container.
while running kitchen verify below output is coming saying it doesn't find the examples.
I am quite sure, I might be missing something related to verifier and suites section in .kitchen.yml. Was trying to fix for couple of days and no luck. can you help me out.

found similar issue neillturner/kitchen-ansible#135 but with older ansible spec plugin.

**_Installing serverspec 2.38.0
       Bundle complete! 2 Gemfile dependencies, 15 gems now installed.
       Use `bundle show [gemname]` to see where a bundled gem is installed.
       Transferring files to <ansible-ubuntu-1404>
       Running Serverspec
       Using default pattern /tmp/verifier/suites/serverspec/*_spec.rb
       ---> RSPEC_CMD variable is: /usr/local/bin/rspec
       No examples found.

       Finished in 0.00032 seconds (files took 0.04711 seconds to load)
       0 examples, 0 failures

       Finished verifying <ansible-ubuntu-1404> (0m14.21s)._**

on the kitchen login, i can see my test files test_spec.rb file existing.

kitchen@f5171c3a7133:/tmp/verifier/serverspec$ ll
total 16
drwxr-xr-x 2 kitchen kitchen 4096 Mar 31 19:56 ./
drwxr-xr-x 3 kitchen kitchen 4096 Mar 31 19:56 ../
-rwxr-xr-x 1 kitchen kitchen 41 Mar 31 19:56 spec_helper.rb*
-rwxr-xr-x 1 kitchen kitchen 162 Mar 31 19:56 test_spec.rb*

My project structure:
/opt/ansible/ansible-kitchen - folder

│ default.yml
│ .kitchen
│ .kitchen.yml
│ Gemfile
│ Gemfile.lock
├── roles
│   └── splunk
│   ├── defaults
│   ├── files
│   ├── handlers
│   ├── meta
│   ├── spec
│   ├── tasks
│ └── main.yml
│   ├── templates
│   ├── tests
│   └── vars
├── spec
│ ──spec_helper.rb
├── test
│   └── integration
│ └── default
│ │ ├── serverspec
│ │   ├── spec_helper.rb
│ │   └── test_spec.rb
│ ── default.yml

│  


└── vendor

contents of .kitchen.yml

---
driver:
  name: docker
  use_sudo: false

platforms:
  - name: ubuntu-14.04
    driver:
       image: rndmh3ro/docker-ubuntu1404-ansible:latest
       platform: ubuntu


provisioner:
  name: ansible_playbook
  hosts: test-kitchen
  roles_path: roles
  ansible_verbose: false
  ansible_verbosity: 2
  require_ansible_repo: false
  require_ansible_omnibus: false
  require_chef_for_busser: false
  ansible_connection: ssh


verifier:
  name: serverspec
  use_sudo: yes
  sudo_path: true

suites:
  - name: default
    verifier:
        default_pattern: true
        bundler_path: '/usr/local/bin'
        rspec_path: '/usr/local/bin'
        env_vars:
              TARGET_HOST: 127.0.0.1
              SUDO: true

Contents of Gem file

source 'https://rubygems.org'
gem 'test-kitchen', '~> 1.8.0'
gem 'kitchen-docker'
gem 'kitchen-ansible'
gem 'net-ssh'
gem 'serverspec'
gem 'kitchen-verifier-serverspec'

contents of default.yml

---
- hosts: test-kitchen

  roles:
     - splunk

contents of /roles/splunk/tasks/main.yml

---
 - name: create directory
   file: path=/opt/splunk state=directory

contents of spec_helper.rb


require 'serverspec'
set :backend, :exec

contents of test_spec.rb

#require 'spec_helper'
#set :backend, :exec
require '/tmp/kitchen/spec/spec_helper.rb'

describe file ('/opt/splunk') do
        it { should be_a_directory 
end

'kitchen verify' finds no tests on 1st run, but finds them on 2nd run

Description

If I run 'kitchen verify' to run my integration tests, the 1st time it cannot find any tests to run, but the 2nd time I run 'kitchen verify' it finds all the tests.

I have had a cursory look round the gem but the only hunch I can come up with is that the default pattern expects to find tests in /tmp/verifier/suites/serverspec/blah_spec.rb, but sometimes after the first run this doesn't exist - /tmp/verifier/serverspec/blah_spec.rb exists instead.

Setup

  • macOS Sierra
  • ruby 2.3.3p222
  • kitchen-verifier-serverspec 0.6.8
  • test-kitchen 1.16.0
  • kitchen-docker 2.6.0
  • Amazon Linux Docker image 2016.09

Verifier options

Some of this is to make up for a separate bug when Amazon Linux is used with the verifier.

  • name: serverspec
  • ruby_bindir: /usr/bin
  • default_pattern: true
  • additional_install_command: sudo -E -H yum install -y ruby-devel gcc gcc-c++ make; sudo gem install up-console

Action fails on Amazon Linux

Provisioning with kitchen-ansible and trying to execute serverspec on ec2 using Amazon Linux platform, results in the following error

kitchen verify ansible-amazon
-----> Starting Kitchen (v1.10.2)
-----> Verifying <ansible-amazon>...
       [Serverspec] Verify on instance=#<Kitchen::Instance:0x007f9bab37cac8> with state={:server_id=>"i-8aa66001", :hostname=>"ec2-52-209-171-33.eu-west-1.compute.amazonaws.com", :last_action=>"setup"}
       Environment variable KITCHEN_SERVER_ID value i-8aa66001
       Environment variable KITCHEN_HOSTNAME value ec2-52-209-171-33.eu-west-1.compute.amazonaws.com
       Environment variable KITCHEN_LAST_ACTION value setup
       Installing ruby, bundler and serverspec remotely on server
Fetching: bundler-1.12.5.gem (100%)
       Successfully installed bundler-1.12.5
       1 gem installed
       /usr/local/bin/bundle
       /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- io/console (LoadError)
        from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/share/ruby/gems/2.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:2:in `<top (required)>'
        from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/share/ruby/gems/2.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/shell/color.rb:1:in `<top (required)>'
        from /usr/local/share/ruby/gems/2.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/shell.rb:17:in `shell'
        from /usr/local/share/ruby/gems/2.0/gems/bundler-1.12.5/lib/bundler/ui/shell.rb:15:in `initialize'
        from /usr/local/share/ruby/gems/2.0/gems/bundler-1.12.5/lib/bundler/cli.rb:13:in `new'
        from /usr/local/share/ruby/gems/2.0/gems/bundler-1.12.5/lib/bundler/cli.rb:13:in `rescue in start'
        from /usr/local/share/ruby/gems/2.0/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
        from /usr/local/share/ruby/gems/2.0/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
        from /usr/local/share/ruby/gems/2.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
        from /usr/local/share/ruby/gems/2.0/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
        from /usr/local/bin/bundle:23:in `load'
        from /usr/local/bin/bundle:23:in `<main>'
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Failed to complete #verify action: [SSH exited (1) for command: [
            if [ ! $(which ruby) ]; then
              echo '-----> Installing ruby, will try to determine platform os'
              if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ] || [ -f /etc/oracle-release ]; then
                sudo -E -H yum -y install ruby
              else
                if [ -f /etc/system-release ] || [ grep -q 'Amazon Linux' /etc/system-release ]; then
                  sudo -E -H yum -y install ruby
                else
                  sudo -E -H apt-get -y install ruby
                fi
              fi
            fi
                        if [ $(sudo -E -H gem list bundler -i) == 'false' ]; then
              sudo -E -H gem install  --no-ri --no-rdoc bundler
            fi

            if [ -d /tmp/kitchen ]; then
                            if [ $(sudo -E -H gem list serverspec -i) == 'false' ]; then
                        sudo -E -H rm -f /tmp/kitchen/Gemfile
sudo -E -H echo "source 'https://rubygems.org'
" >> /tmp/kitchen/Gemfile
sudo -E -H echo "
" >> /tmp/kitchen/Gemfile
sudo -E -H echo "gem 'net-ssh','~> 2.9'
" >> /tmp/kitchen/Gemfile
sudo -E -H echo "gem 'io-console', '~> 0.4.2'
" >> /tmp/kitchen/Gemfile
sudo -E -H echo "gem "json"
" >> /tmp/kitchen/Gemfile
sudo -E -H echo "gem "rake"
" >> /tmp/kitchen/Gemfile
sudo -E -H echo "gem "serverspec"" >> /tmp/kitchen/Gemfile


              BUNDLE_CMD=$(which bundle)
              echo $BUNDLE_CMD
              sudo -E -H  $BUNDLE_CMD install --gemfile=/tmp/kitchen/Gemfile
            fi


            else
              echo "ERROR: Default path '/tmp/kitchen' does not exist"
              exit 1
            fi
]] on ansible-amazon
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

Any ideas?

Overwriting Gemfile when setting remote_exec false

Given the following .kitchen.yml:

---
driver:
  name: docker

provisioner:
  name: ansible_playbook
  hosts: test-kitchen
  ansible_verbose: false
  ansible_verbosity: 2
  require_ansible_repo: false
  require_ansible_omnibus: true
  require_chef_for_busser: false

verifier:
  name: serverspec
  remote_exec: false
  bundler_path: '/usr/local/bin'
  rspec_path: '/usr/local/bin'
  patterns:
    - test/integration/default/serverspec/default_spec.rb

platforms:
  - name: centos-7.2

suites:
  - name: default

looks like the code here is overwriting my project's Gemfile, which I'd have to assume is a bug.

bundler: command not found

Hi there, I'm not sure which component has the problem so I'm only guessing that it's this one.

Getting a failure like this:

-----> Setting up <default-centos-72>...
$$$$$$ Running legacy setup for 'Docker' Driver
       Installing ruby, bundler and serverspec remotely on server
Fetching: bundler-1.12.4.gem (100%)
       Successfully installed bundler-1.12.4
       1 gem installed
       sudo: bundler: command not found
>>>>>> Setup failed on instance <default-centos-72>.
>>>>>> Please see .kitchen/logs/default-centos-72.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [            
            if [ ! $(which ruby) ]; then
              echo '-----> Installing ruby, will try to determine platform os'
              if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ] || [ -f /etc/oracle-release ]; then
                sudo -E yum -y install ruby
              else
                if [ -f /etc/system-release ] || [ grep -q 'Amazon Linux' /etc/system-release ]; then
                  sudo -E yum -y install ruby
                else
                  sudo -E apt-get -y install ruby
                fi
              fi
            fi
                        if [ $(sudo -E gem list bundler -i) == 'false' ]; then
              sudo -E gem install  --no-ri --no-rdoc bundler
            fi

            if [ -d /tmp/kitchen ]; then
                            if [ $(sudo -E gem list serverspec -i) == 'false' ]; then
                        sudo -E rm -f /tmp/kitchen/Gemfile
          sudo -E echo "source 'https://rubygems.org'" >> /tmp/kitchen/Gemfile
          sudo -E echo "gem 'net-ssh','~> 2.9'"  >> /tmp/kitchen/Gemfile
          sudo -E echo "gem 'serverspec'" >> /tmp/kitchen/Gemfile

              sudo -E bundler install --gemfile=/tmp/kitchen/Gemfile
            fi


            else
              echo "ERROR: Default path '/tmp/kitchen' does not exist"
              exit 1
            fi
]
>>>>>> ----------------------

My .kitchen.yml:

---
driver:
  name: docker

provisioner:
  name: ansible_playbook
  hosts: test-kitchen
  ansible_verbose: false
  ansible_verbosity: 2
  require_ansible_repo: false
  require_ansible_omnibus: true

verifier:
  name: serverspec

platforms:
  - name: centos-7.2

suites:
  - name: default

And my bundle:

$ bundle show 
Gems included by the bundle:
  * artifactory (2.3.2)
  * backticks (0.4.0)
  * bundler (1.10.5)
  * docker (0.3.1)
  * faraday (0.9.2)
  * highline (1.7.8)
  * kitchen-ansible (0.42.5)
  * kitchen-docker (2.4.0)
  * kitchen-verifier-serverspec (0.4.2)
  * librarian (0.1.2)
  * librarian-ansible (3.0.0)
  * mixlib-install (1.0.11)
  * mixlib-shellout (2.2.6)
  * mixlib-versioning (1.1.0)
  * multipart-post (2.0.0)
  * net-scp (1.2.1)
  * net-ssh (3.1.1)
  * safe_yaml (1.0.4)
  * test-kitchen (1.8.0)
  * thor (0.19.1)

default_pattern not compatible with busser-serverspec?

Hi,

We try to use kitchen-verifier-serverspec as a drop-in replacement for busser-serverspec.
In my .kitchen.yml I have:

verifier:
  name: serverspec
  default_pattern: true

Our test patterns are at test/integration/_suite_/serverspec/localhost/*_spec.rb as described in
https://github.com/test-kitchen/busser-serverspec/blob/master/README.md#Usage.
They get copied to /tmp/verifier/suites/serverspec/localhost but kitchen-verifier-serverspec looks into the wrong folder:

   Transferring files to <instance>
   Running Serverspec
   Using default pattern /tmp/verifier/suites/serverspec/*_spec.rb
   ---> RSPEC_CMD variable is: /usr/bin/rspec
   No examples found.
   
   Finished in 0.00033 seconds (files took 0.05918 seconds to load)
   0 examples, 0 failures

Apparently I missed something here, but what?

Kind regards,
Christopher

default_pattern option doesn't work in remote_exec mode

The generated pattern contains a path from the originating host (workstation), instead of the base path containing the copy inside the remote host (under test).

Running Serverspec
Using default pattern /home/danielkza/ansible/DavidWittman.redis/test/integration/facts/serverspec/*_spec.rb
/usr/local/bin/rspec
No examples found.
$ ls /home/danielkza/ansible/DavidWittman.redis/test/integration/facts/serverspec/*_spec.rb
/home/danielkza/ansible/DavidWittman.redis/test/integration/service-name/serverspec/redis_spec.rb

bundler v2.2.30 breaks remote gem installation

Bundler::GemNotFound: Could not find net-telnet-0.1.1.gem for installation
full log: https://github.com/aerickson/test_kitchen_docker_serverspec_bug_demo/runs/4099762256?check_suite_focus=true

demo repo: https://github.com/aerickson/test_kitchen_docker_serverspec_bug_demo

Setting a non-standard path for bundler (via --path) makes bundle install work, but a next step fails because it can't find rspec. Need to use bundle exec to find it in the non-standard path, but having issues with multiple which levels. See https://github.com/aerickson/test_kitchen_docker_serverspec_bug_demo/tree/fix_attempt.

CentOS 6.x failure

When testing against CentOS 6 hosts, it seems the rubygems package is not installed which then causes the "verify" step to fail.

To resolve the issue I just logged into the box manually and installed rubygems

See the output:

>>>>>> ------Exception-------                                                        
>>>>>> Class: Kitchen::ActionFailed                                                  
>>>>>> Message: 1 actions failed.                                                    
>>>>>>     Failed to complete #verify action: [SSH exited (1) for command: [                                                                                               
            if [ ! $(which ruby) ]; then                                             
              echo '-----> Installing ruby, will try to determine platform os'       
              if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ] || [ -f /etc/oracle-release ]; then                                                              
                sudo -E -H yum -y install ruby                                       
              else                                                                   
                if [ -f /etc/system-release ] && grep -q 'Amazon Linux' /etc/system-release; then                                                                          
                  sudo -E -H yum -y install ruby                                     
                else                                                                 
                  sudo -E -H apt-get -y install ruby                                 
                fi                                                                   
              fi                                                                     
            fi                                                                       
                        if [ "$(sudo -E -H gem list bundler -i)" = "true" ]; then    
              echo "Bundler already installed"                                       
            else                                                                     
              if [ "$(sudo -E -H gem list bundler -i)" = "false" ]; then             
                sudo -E -H gem install  --no-ri --no-rdoc bundler                    
              else                                                                   
                echo "ERROR: Ruby not installed correctly"                           
                exit 1                                                               
              fi                                                                     
            fi                                                                       

            if [ -d /tmp/kitchen ]; then                                             
                            if [ "$(sudo -E -H gem list serverspec -i)" = "false" ]; then                                                                                  
                        sudo -E -H rm -f /tmp/kitchen/Gemfile                        
          sudo -E -H echo "source 'https://rubygems.org'" >> /tmp/kitchen/Gemfile    
          sudo -E -H echo "gem 'net-ssh','~> 2.9'"  >> /tmp/kitchen/Gemfile          
          sudo -E -H echo "gem 'serverspec'" >> /tmp/kitchen/Gemfile                 

              BUNDLE_CMD=$(which bundle)                                             
              echo "---> BUNDLE_CMD variable is: ${BUNDLE_CMD}"                      
              sudo -E -H  $BUNDLE_CMD install --gemfile=/tmp/kitchen/Gemfile         
            fi                                                                       

                                                                                     
            else                                                                     
              echo "ERROR: Default path '/tmp/kitchen' does not exist"               
              exit 1                                                                 
            fi                                                                       
]] on default-centos-6                                                               
>>>>>> ----------------------                                                        
>>>>>> Please see .kitchen/logs/kitchen.log for more details                         
>>>>>> Also try running `kitchen diagnose --all` for configuration                   
---
# kitchen.yml
driver:
  name: 'vagrant'

provisioner:
  name: 'ansible_playbook'
  hosts: "localhost"
  require_ansible_repo: false
  require_ansible_omnibus: false
  require_ansible_source: false
  require_pip: true
  ansible_version: 'latest'
  ansible_verbose: true
  require_chef_for_busser: false
  require_ruby_for_busser: false
  ignore_paths_from_root: [".git",".idea",".kitchen", ".bin", ".kitchen.yml", ".gems", ".bundle"]

verifier:
  name: 'serverspec'
  default_pattern: true

platforms:
  - name: 'ubuntu-16.04'
  - name: 'centos-7'
  - name: 'centos-6'

suites:
  - name: 'default'
    attributes:
    run_list:

Failed to complete #setup action:

Hello!
I'm trying to setup test-kitchen with docker driver, kitchen-ansible and kitchen-verifier-serverspec, but it dies with error:

-----> Starting Kitchen (v1.6.0)
D      [kitchen::driver::docker command] BEGIN (sudo -E docker >> /dev/null 2>&1)
D      [kitchen::driver::docker command] END (0m0.11s)
-----> Setting up <default-centos-67>...
$$$$$$ Running legacy setup for 'Docker' Driver
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #setup action: [private method `install_command' called for #<Kitchen::Verifier::Serverspec:0x000000020e3c40>]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

D      ------Exception-------
D      Class: Kitchen::ActionFailed
D      Message: Failed to complete #setup action: [private method `install_command' called for #<Kitchen::Verifier::Serverspec:0x000000020e3c40>]
D      ---Nested Exception---
D      Class: NoMethodError
D      Message: private method `install_command' called for #<Kitchen::Verifier::Serverspec:0x000000020e3c40>
D      ------Backtrace-------
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/driver/ssh_base.rb:95:in `block in setup'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/transport/base.rb:86:in `initialize'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/transport/ssh.rb:350:in `new'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/transport/ssh.rb:350:in `create_new_connection'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/transport/ssh.rb:85:in `connection'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/driver/ssh_base.rb:94:in `setup'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/instance.rb:602:in `legacy_ssh_base_setup'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/instance.rb:388:in `block in setup_action'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/instance.rb:513:in `call'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/instance.rb:513:in `synchronize_or_call'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/instance.rb:478:in `block in action'
D      /usr/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/instance.rb:477:in `action'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/instance.rb:387:in `setup_action'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/instance.rb:348:in `block in transition_to'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/instance.rb:347:in `each'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/instance.rb:347:in `transition_to'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/instance.rb:160:in `verify'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/command.rb:176:in `public_send'
D      /var/lib/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/command.rb:176:in `block (2 levels) in run_action'
D      ----------------------

My kitchen.yml


---
driver:
  name: docker

provisioner:
  name: ansible_playbook
  hosts: localhost
  playbook: site.yml
  require_ansible_repo: true
  require_ruby_for_busser: true

platforms:
  - name: centos-6.7

verifier:
  name: serverspec
  sudo_path: true
  remote_execution: true

suites:
  - name: default
    run_list:
    attributes:

and my installed gems:

*** LOCAL GEMS ***

backticks (0.4.0)
bigdecimal (1.2.4)
bundler (1.11.2)
diff-lcs (1.2.5)
docker (0.3.1)
faraday (0.9.2)
highline (1.7.8)
io-console (0.4.2)
json (1.8.1)
kitchen-ansible (0.40.1, 0.0.32)
kitchen-docker (2.3.0, 1.5.0)
kitchen-verifier-serverspec (0.3.0)
librarian (0.1.2)
librarian-ansible (3.0.0)
minitest (4.7.5)
mixlib-install (0.7.1)
mixlib-shellout (2.2.6, 1.6.1)
multi_json (1.11.2)
multipart-post (2.0.0)
net-scp (1.2.1)
net-ssh (2.9.4)
psych (2.0.5)
rake (10.1.0)
rdoc (4.1.0)
rspec (3.4.0)
rspec-core (3.4.4)
rspec-expectations (3.4.0)
rspec-its (1.2.0)
rspec-mocks (3.4.1)
rspec-support (3.4.1)
safe_yaml (1.0.4)
serverspec (2.3.1)
specinfra (2.4.5)
test-kitchen (1.6.0, 1.2.1)
test-unit (2.1.5.0)
thor (0.19.1)

Where I am wrong? Maybe I am miss something?

Thanks

Help with spec_helper.rb ( LoadError: cannot load such file -- spec_helper )

Hello! I've just started to use kitchen-ansible again and was testing out this kitchen-verifier-serverspec to speed the old Chef / busser run path up. However, I'm not sure I have everything configured properly, because rspec is complaining about missing spec_helper.rb:

       LoadError:
         cannot load such file -- spec_helper

It looks like it is not finding spec_helper.rb because it's missing LOAD_PATH rspec -I, or such option. Weird, because I thought default for rspec was usually to look in $(pwd)/spec/spec_helper.rb. Maybe I'm missing something obvious?

I also tried adding it to the old Chef / busser-serverspec location test/integration/helpers/serverspec/spec_helper.rb, but it did not work either.

Here is my spec/spec_helper.rb:

require 'serverspec'

set :backend, :exec

Here is my initial roles/ldap_client/test/integration/dev/serverspec/ldap_client_spec.rb:

require 'spec_helper'

ldap_client_packages  = %w( 
                      sssd
                      oddjob-mkhomedir
                    )
ldap_client_services  = %w(
                      sssd
                      oddjobd
                      sshd
                    )

ldap_client_packages.each do |pkg|
  describe package(pkg) do
    it { should be_installed }
  end
end

ldap_client_services.each do |svc|
  describe service(svc) do
    it { should be_installed }
    it { should be_enabled }
    it { should be_running }
  end
end

Here is my .kitchen.yml:

---
driver:
    name: vagrant

provisioner:
  name: ansible_playbook
#  roles_path:
  hosts: test-kitchen
  require_ansible_repo: true
  ansible_version: latest
  require_chef_for_busser: false
#  ansible_check: true
  ansible_diff: true
  ansible_verbose: true
  ansible_verbosity: 2
  sudo: true
# Tried adding in "-I spec" into .rspec file at top "roles/ldap_client/.rspec" dir, but it did not copy into /tmp/kitchen where rspec runs from as working directory... so it did not work still
#  additional_copy_path:
#    - .rspec
  extra_vars:
    environment: dev

verifier:
  name: serverspec
  sudo_path: true
  default_pattern: true

platforms:
  - name: centos-7.1

suites:
  - name: dev
# Tried this, but still didn't find spec_helper.rb
#    verifier:
#      patterns:
#      - roles/ldap_client/test/integration/dev/serverspec/*_spec.rb
    provisioner:
      playbook: test/integration/dev.yml

Here is the kitchen copied project layout as seen from /tmp/kitchen:

/tmp/kitchen/
├── ansible.cfg
├── callback_plugins
├── dev.yml
├── filter_plugins
├── Gemfile
├── Gemfile.lock
├── group_vars
├── hosts
├── host_vars
├── library
├── lookup_plugins
├── modules
├── roles
│   └── ldap_client
│       ├── defaults
│       │   └── main.yml
│       ├── handlers
│       │   └── main.yml
│       ├── meta
│       │   └── main.yml
│       ├── README.md
│       ├── spec
│       │   └── spec_helper.rb
│       ├── tasks
│       │   ├── ldap_client.yml
│       │   ├── main.yml
│       │   └── sshd_config_overrides.yml
│       ├── templates
│       │   └── test-sssd.conf
│       ├── test
│       │   ├── bin
│       │   │   └── kitchen-cloud-test
│       │   └── integration
│       │       ├── dev
│       │       │   └── serverspec
│       │       │       └── ldap_client_spec.rb
│       │       ├── dev.yml
│       │       ├── ec2.yml
│       │       └── helpers
│       │           └── serverspec
│       │               └── spec_helper.rb
│       └── vars
│           └── main.yml
├── spec
│   └── spec_helper.rb
└── ssh_private_keys

The /tmp/verifier dir has:

/tmp/verifier/
└── suites
    └── serverspec
        └── ldap_client_spec.rb

2 directories, 1 file

Below is a kitchen verify --log-level=debug output:

       PLAY RECAP *********************************************************************
       localhost                  : ok=24   changed=20   unreachable=0    failed=0

D      Cleaning up local sandbox in /var/folders/p2/x1jx6zzs2r1fvzw6408yr308rbm67m/T/dev-centos-71-sandbox-20180131-41208-csp83r
       Finished converging <dev-centos-71> (1m6.87s).
-----> Setting up <dev-centos-71>...
       Finished setting up <dev-centos-71> (0m0.00s).
-----> Verifying <dev-centos-71>...
       [Serverspec] Verify on instance=#<Kitchen::Instance:0x007f8e57315488> with state={:hostname=>"127.0.0.1", :port=>"2222", :username=>"vagrant", :ssh_key=>"/Users/jcuzella/src/pp/efd-ansible-playbooks/roles/ldap_client/.kitchen/kitchen-vagrant/kitchen-ldap_client-dev-centos-71/.vagrant/machines/default/virtualbox/private_key", :last_action=>"setup"}
       Environment variable KITCHEN_HOSTNAME value 127.0.0.1
       Environment variable KITCHEN_PORT value 2222
       Environment variable KITCHEN_USERNAME value vagrant
       Environment variable KITCHEN_SSH_KEY value /Users/jcuzella/src/pp/efd-ansible-playbooks/roles/ldap_client/.kitchen/kitchen-vagrant/kitchen-ldap_client-dev-centos-71/.vagrant/machines/default/virtualbox/private_key
       Environment variable KITCHEN_LAST_ACTION value setup
       Transport Environment variable KITCHEN_USERNAME value root
       Transport Environment variable KITCHEN_PORT value 22
D      Running Serverspec on remote server
       Preparing files for transfer
D      Creating local sandbox in /var/folders/p2/x1jx6zzs2r1fvzw6408yr308rbm67m/T/dev-centos-71-sandbox-20180131-41208-1c6hw7
D      Creating local sandbox of all test suite files in /Users/jcuzella/src/pp/efd-ansible-playbooks/roles/ldap_client/test/integration/dev
D      [SSH] reusing existing connection [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>"2222", :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/Users/jcuzella/src/pp/efd-ansible-playbooks/roles/ldap_client/.kitchen/kitchen-vagrant/kitchen-ldap_client-dev-centos-71/.vagrant/machines/default/virtualbox/private_key"], :auth_methods=>["publickey"], :user=>"vagrant"}>
       Installing ruby, bundler and serverspec remotely on server
D      [SSH] [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>"2222", :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/Users/jcuzella/src/pp/efd-ansible-playbooks/roles/ldap_client/.kitchen/kitchen-vagrant/kitchen-ldap_client-dev-centos-71/.vagrant/machines/default/virtualbox/private_key"], :auth_methods=>["publickey"], :user=>"vagrant"}> (
            if [ ! $(which ruby) ]; then
              echo '-----> Installing ruby, will try to determine platform os'
              if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ] || [ -f /etc/oracle-release ]; then
                sudo -E -H yum -y install ruby
              else
                if [ -f /etc/system-release ] && grep -q 'Amazon Linux' /etc/system-release; then
                  sudo -E -H yum -y install ruby
                else
                  sudo -E -H apt-get -y install ruby
                fi
              fi
            fi
                        if [ "$(sudo -E -H gem list bundler -i)" = "true" ]; then
              echo "Bundler already installed"
            else
              if [ "$(sudo -E -H gem list bundler -i)" = "false" ]; then
                sudo -E -H gem install  --no-ri --no-rdoc bundler
              else
                echo "ERROR: Ruby not installed correctly"
                exit 1
              fi
            fi

            if [ -d /tmp/kitchen ]; then
                            if [ "$(sudo -E -H gem list serverspec -i)" = "false" ]; then
                        sudo -E -H rm -f /tmp/kitchen/Gemfile
          sudo -E -H echo "source 'https://rubygems.org'" >> /tmp/kitchen/Gemfile
          sudo -E -H echo "gem 'net-ssh','~> 2.9'"  >> /tmp/kitchen/Gemfile
          sudo -E -H echo "gem 'serverspec'" >> /tmp/kitchen/Gemfile

              BUNDLE_CMD=$(which bundle)
              echo "---> BUNDLE_CMD variable is: ${BUNDLE_CMD}"
              sudo -E -H  $BUNDLE_CMD install --gemfile=/tmp/kitchen/Gemfile
            fi


            else
              echo "ERROR: Default path '/tmp/kitchen' does not exist"
              exit 1
            fi
)
       which: no ruby in (/usr/local/bin:/usr/bin)
-----> Installing ruby, will try to determine platform os
       Loaded plugins: fastestmirror
       Loading mirror speeds from cached hostfile
        * base: centos-distro.cavecreek.net
        * epel: mirror.compevo.com
        * extras: centos.s.uw.edu
        * updates: centos.mirror.lstn.net
       Resolving Dependencies
       --> Running transaction check
       ---> Package ruby.x86_64 0:2.0.0.648-30.el7 will be installed
       --> Processing Dependency: ruby-libs(x86-64) = 2.0.0.648-30.el7 for package: ruby-2.0.0.648-30.el7.x86_64
       --> Processing Dependency: rubygem(bigdecimal) >= 1.2.0 for package: ruby-2.0.0.648-30.el7.x86_64
       --> Processing Dependency: ruby(rubygems) >= 2.0.14.1 for package: ruby-2.0.0.648-30.el7.x86_64
       --> Processing Dependency: libruby.so.2.0()(64bit) for package: ruby-2.0.0.648-30.el7.x86_64
       --> Running transaction check
       ---> Package ruby-libs.x86_64 0:2.0.0.648-30.el7 will be installed
       ---> Package rubygem-bigdecimal.x86_64 0:1.2.0-30.el7 will be installed
       ---> Package rubygems.noarch 0:2.0.14.1-30.el7 will be installed
       --> Processing Dependency: rubygem(rdoc) >= 4.0.0 for package: rubygems-2.0.14.1-30.el7.noarch
       --> Processing Dependency: rubygem(psych) >= 2.0.0 for package: rubygems-2.0.14.1-30.el7.noarch
       --> Processing Dependency: rubygem(io-console) >= 0.4.2 for package: rubygems-2.0.14.1-30.el7.noarch
       --> Running transaction check
       ---> Package rubygem-io-console.x86_64 0:0.4.2-30.el7 will be installed
       ---> Package rubygem-psych.x86_64 0:2.0.0-30.el7 will be installed
       ---> Package rubygem-rdoc.noarch 0:4.0.0-30.el7 will be installed
       --> Processing Dependency: ruby(irb) = 2.0.0.648 for package: rubygem-rdoc-4.0.0-30.el7.noarch
       --> Processing Dependency: rubygem(json) >= 1.7.7 for package: rubygem-rdoc-4.0.0-30.el7.noarch
       --> Running transaction check
       ---> Package ruby-irb.noarch 0:2.0.0.648-30.el7 will be installed
       ---> Package rubygem-json.x86_64 0:1.7.7-30.el7 will be installed
       --> Finished Dependency Resolution

       Dependencies Resolved

       ================================================================================
        Package                  Arch         Version                 Repository  Size
       ================================================================================
       Installing:
        ruby                     x86_64       2.0.0.648-30.el7        base        69 k
       Installing for dependencies:
        ruby-irb                 noarch       2.0.0.648-30.el7        base        90 k
        ruby-libs                x86_64       2.0.0.648-30.el7        base       2.8 M
        rubygem-bigdecimal       x86_64       1.2.0-30.el7            base        81 k
        rubygem-io-console       x86_64       0.4.2-30.el7            base        52 k
        rubygem-json             x86_64       1.7.7-30.el7            base        77 k
        rubygem-psych            x86_64       2.0.0-30.el7            base        79 k
        rubygem-rdoc             noarch       4.0.0-30.el7            base       319 k
        rubygems                 noarch       2.0.14.1-30.el7         base       216 k

       Transaction Summary
       ================================================================================
       Install  1 Package (+8 Dependent packages)

       Total download size: 3.8 M
       Installed size: 13 M
       Downloading packages:
(1/9): ruby-2.0.0.648-30.el7.x86_64.rpm                    |  69 kB   00:00
(2/9): rubygem-bigdecimal-1.2.0-30.el7.x86_64.rpm          |  81 kB   00:00
(3/9): rubygem-json-1.7.7-30.el7.x86_64.rpm                |  77 kB   00:00
(4/9): rubygem-psych-2.0.0-30.el7.x86_64.rpm               |  79 kB   00:00
(5/9): ruby-irb-2.0.0.648-30.el7.noarch.rpm                |  90 kB   00:00
(6/9): rubygem-rdoc-4.0.0-30.el7.noarch.rpm                | 319 kB   00:00
(7/9): rubygems-2.0.14.1-30.el7.noarch.rpm                 | 216 kB   00:00
(8/9): rubygem-io-console-0.4.2-30.el7.x86_64.rpm          |  52 kB   00:00
(9/9): ruby-libs-2.0.0.648-30.el7.x86_64.rpm               | 2.8 MB   00:01
       --------------------------------------------------------------------------------
       Total                                              2.7 MB/s | 3.8 MB  00:01
       Running transaction check
       Running transaction test
       Transaction test succeeded
       Running transaction
  Installing : ruby-libs-2.0.0.648-30.el7.x86_64                            1/9
  Installing : rubygem-io-console-0.4.2-30.el7.x86_64                       2/9
  Installing : rubygem-psych-2.0.0-30.el7.x86_64                            3/9
  Installing : ruby-irb-2.0.0.648-30.el7.noarch                             4/9
  Installing : ruby-2.0.0.648-30.el7.x86_64                                 5/9
  Installing : rubygem-bigdecimal-1.2.0-30.el7.x86_64                       6/9
  Installing : rubygems-2.0.14.1-30.el7.noarch                              7/9
  Installing : rubygem-json-1.7.7-30.el7.x86_64                             8/9
  Installing : rubygem-rdoc-4.0.0-30.el7.noarch                             9/9
  Verifying  : rubygem-json-1.7.7-30.el7.x86_64                             1/9
  Verifying  : rubygem-rdoc-4.0.0-30.el7.noarch                             2/9
  Verifying  : ruby-irb-2.0.0.648-30.el7.noarch                             3/9
  Verifying  : ruby-2.0.0.648-30.el7.x86_64                                 4/9
  Verifying  : ruby-libs-2.0.0.648-30.el7.x86_64                            5/9
  Verifying  : rubygem-io-console-0.4.2-30.el7.x86_64                       6/9
  Verifying  : rubygem-psych-2.0.0-30.el7.x86_64                            7/9
  Verifying  : rubygems-2.0.14.1-30.el7.noarch                              8/9
  Verifying  : rubygem-bigdecimal-1.2.0-30.el7.x86_64                       9/9

       Installed:
         ruby.x86_64 0:2.0.0.648-30.el7

       Dependency Installed:
         ruby-irb.noarch 0:2.0.0.648-30.el7
         ruby-libs.x86_64 0:2.0.0.648-30.el7
         rubygem-bigdecimal.x86_64 0:1.2.0-30.el7
         rubygem-io-console.x86_64 0:0.4.2-30.el7
         rubygem-json.x86_64 0:1.7.7-30.el7
         rubygem-psych.x86_64 0:2.0.0-30.el7
         rubygem-rdoc.noarch 0:4.0.0-30.el7
         rubygems.noarch 0:2.0.14.1-30.el7

       Complete!
Fetching: bundler-1.16.1.gem (100%)
       Successfully installed bundler-1.16.1
       1 gem installed
       ---> BUNDLE_CMD variable is: /usr/local/bin/bundle
       Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
       installing your bundle as root will break this application for all non-root
       users on this machine.
       Fetching gem metadata from https://rubygems.org/......
       Resolving dependencies...
       RubyGems 2.0.14.1 is not threadsafe, so your gems will be installed one at a time. Upgrade to RubyGems 2.1.0 or higher to enable parallel gem installation.
       Using bundler 1.16.1
       Fetching diff-lcs 1.3
       Installing diff-lcs 1.3
       Fetching multi_json 1.13.1
       Installing multi_json 1.13.1
       Fetching net-ssh 2.9.4
       Installing net-ssh 2.9.4
       Fetching net-scp 1.2.1
       Installing net-scp 1.2.1
       Fetching net-telnet 0.1.1
       Installing net-telnet 0.1.1
       Fetching rspec-support 3.7.1
       Installing rspec-support 3.7.1
       Fetching rspec-core 3.7.1
       Installing rspec-core 3.7.1
       Fetching rspec-expectations 3.7.0
       Installing rspec-expectations 3.7.0
       Fetching rspec-mocks 3.7.0
       Installing rspec-mocks 3.7.0
       Fetching rspec 3.7.0
       Installing rspec 3.7.0
       Fetching rspec-its 1.2.0
       Installing rspec-its 1.2.0
       Fetching sfl 2.3
       Installing sfl 2.3
       Fetching specinfra 2.73.1
       Installing specinfra 2.73.1
       Fetching serverspec 2.41.3
       Installing serverspec 2.41.3
       Bundle complete! 2 Gemfile dependencies, 15 gems now installed.
       Use `bundle info [gemname]` to see where a bundled gem is installed.
       Transferring files to <dev-centos-71>
D      TIMING: scp async upload (Kitchen::Transport::Ssh)
D      TIMING: scp async upload (Kitchen::Transport::Ssh) took (0m0.06s)
D      Transfer complete
       Running Serverspec
       Using default pattern /tmp/verifier/suites/serverspec/*_spec.rb
D      [SSH] [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>"2222", :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/Users/jcuzella/src/pp/efd-ansible-playbooks/roles/ldap_client/.kitchen/kitchen-vagrant/kitchen-ldap_client-dev-centos-71/.vagrant/machines/default/virtualbox/private_key"], :auth_methods=>["publickey"], :user=>"vagrant"}> (
            mkdir -p /tmp/kitchen
            cd /tmp/kitchen
            RSPEC_CMD=$(which rspec)
            echo "---> RSPEC_CMD variable is: ${RSPEC_CMD}"
             sudo -E -H  $RSPEC_CMD -c -f documentation --default-path  /tmp/kitchen  -P /tmp/verifier/suites/serverspec/*_spec.rb

)
       ---> RSPEC_CMD variable is: /usr/local/bin/rspec

       An error occurred while loading /tmp/verifier/suites/serverspec/ldap_client_spec.rb.
       Failure/Error: return gem_original_require(path)

       LoadError:
         cannot load such file -- spec_helper
       # /tmp/verifier/suites/serverspec/ldap_client_spec.rb:1:in `<top (required)>'
       No examples found.

       Finished in 0.00019 seconds (files took 0.06423 seconds to load)
       0 examples, 0 failures, 1 error occurred outside of examples

D      [SSH] shutting previous connection [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>"2222", :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/Users/jcuzella/src/pp/efd-ansible-playbooks/roles/ldap_client/.kitchen/kitchen-vagrant/kitchen-ldap_client-dev-centos-71/.vagrant/machines/default/virtualbox/private_key"], :auth_methods=>["publickey"], :user=>"vagrant"}>
D      [SSH] closing connection to [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>"2222", :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/Users/jcuzella/src/pp/efd-ansible-playbooks/roles/ldap_client/.kitchen/kitchen-vagrant/kitchen-ldap_client-dev-centos-71/.vagrant/machines/default/virtualbox/private_key"], :auth_methods=>["publickey"], :user=>"vagrant"}>
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Failed to complete #verify action: [SSH exited (1) for command: [
            mkdir -p /tmp/kitchen
            cd /tmp/kitchen
            RSPEC_CMD=$(which rspec)
            echo "---> RSPEC_CMD variable is: ${RSPEC_CMD}"
             sudo -E -H  $RSPEC_CMD -c -f documentation --default-path  /tmp/kitchen  -P /tmp/verifier/suites/serverspec/*_spec.rb

]] on dev-centos-71
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

D      ------Exception-------
D      Class: Kitchen::ActionFailed
D      Message: 1 actions failed.
>>>>>>     Failed to complete #verify action: [SSH exited (1) for command: [
            mkdir -p /tmp/kitchen
            cd /tmp/kitchen
            RSPEC_CMD=$(which rspec)
            echo "---> RSPEC_CMD variable is: ${RSPEC_CMD}"
             sudo -E -H  $RSPEC_CMD -c -f documentation --default-path  /tmp/kitchen  -P /tmp/verifier/suites/serverspec/*_spec.rb

]] on dev-centos-71
D      ----------------------
D      ------Backtrace-------
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:187:in `report_errors'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:178:in `run_action'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command/test.rb:45:in `block in call'
D      /opt/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command/test.rb:41:in `call'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/cli.rb:56:in `perform'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/cli.rb:232:in `test'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/cli.rb:326:in `invoke_task'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/bin/kitchen:13:in `block in <top (required)>'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/errors.rb:174:in `with_friendly_errors'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/bin/kitchen:13:in `<top (required)>'
D      /usr/local/bin/kitchen:18:in `load'
D      /usr/local/bin/kitchen:18:in `<main>'
D      ----End Backtrace-----
D      -Composite Exception--
D      Class: Kitchen::ActionFailed
D      Message: Failed to complete #verify action: [SSH exited (1) for command: [
            mkdir -p /tmp/kitchen
            cd /tmp/kitchen
            RSPEC_CMD=$(which rspec)
            echo "---> RSPEC_CMD variable is: ${RSPEC_CMD}"
             sudo -E -H  $RSPEC_CMD -c -f documentation --default-path  /tmp/kitchen  -P /tmp/verifier/suites/serverspec/*_spec.rb

]] on dev-centos-71
D      ----------------------
D      ------Backtrace-------
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/transport/ssh.rb:131:in `execute'
D      /Users/jcuzella/.chefdk/gem/ruby/2.1.0/gems/kitchen-verifier-serverspec-0.6.10/lib/kitchen/verifier/serverspec.rb:69:in `block in call'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/transport/ssh.rb:450:in `reuse_connection'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/transport/ssh.rb:91:in `connection'
D      /Users/jcuzella/.chefdk/gem/ruby/2.1.0/gems/kitchen-verifier-serverspec-0.6.10/lib/kitchen/verifier/serverspec.rb:62:in `call'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:423:in `block in verify_action'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:513:in `call'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:513:in `synchronize_or_call'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:478:in `block in action'
D      /opt/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:477:in `action'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:415:in `verify_action'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:348:in `block in transition_to'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:347:in `each'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:347:in `transition_to'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:160:in `verify'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:189:in `block in test'
D      /opt/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:185:in `test'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:201:in `public_send'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:201:in `run_action_in_thread'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:173:in `block (2 levels) in run_action'
D      ----End Backtrace-----
D      ---Nested Exception---
D      Class: Kitchen::ActionFailed
D      Message: Failed to complete #verify action: [SSH exited (1) for command: [
            mkdir -p /tmp/kitchen
            cd /tmp/kitchen
            RSPEC_CMD=$(which rspec)
            echo "---> RSPEC_CMD variable is: ${RSPEC_CMD}"
             sudo -E -H  $RSPEC_CMD -c -f documentation --default-path  /tmp/kitchen  -P /tmp/verifier/suites/serverspec/*_spec.rb

]]
D      ----------------------
D      ------Backtrace-------
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/transport/ssh.rb:131:in `execute'
D      /Users/jcuzella/.chefdk/gem/ruby/2.1.0/gems/kitchen-verifier-serverspec-0.6.10/lib/kitchen/verifier/serverspec.rb:69:in `block in call'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/transport/ssh.rb:450:in `reuse_connection'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/transport/ssh.rb:91:in `connection'
D      /Users/jcuzella/.chefdk/gem/ruby/2.1.0/gems/kitchen-verifier-serverspec-0.6.10/lib/kitchen/verifier/serverspec.rb:62:in `call'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:423:in `block in verify_action'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:513:in `call'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:513:in `synchronize_or_call'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:478:in `block in action'
D      /opt/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:477:in `action'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:415:in `verify_action'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:348:in `block in transition_to'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:347:in `each'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:347:in `transition_to'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:160:in `verify'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:189:in `block in test'
D      /opt/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:185:in `test'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:201:in `public_send'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:201:in `run_action_in_thread'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:173:in `block (2 levels) in run_action'
D      ----End Backtrace-----

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.