0

Using kitchen verify I got a double report of my suite test. I don't know why and it is happening only in this cookbook. I ran the same kitchen verify command and the output is clear so what is different now?

It is the output (with double report):

-----> Setting up <default-centos-72>...
       Finished setting up <default-centos-72> (0m0.00s).
-----> Verifying <default-centos-72>...
       Detected alternative framework tests for `inspec`
       Loaded
       Loaded

Target:  ssh://kitchen@localhost:32785

  ✔  When OS is Redhat :: Nginx service need to be installed and configured
     ✔  System Package nginx should be installed
     ✔  Group www-data should exist
     ✔  User www-data should exist
     ✔  File /etc/nginx/sites-available/mysite should be file
     ✔  File /etc/nginx/sites-available/mysite content should match "listen 80;"
     ✔  File /etc/nginx/sites-available/mysite content should match "server_name docs.mydomain.com default;"
     ✔  File /etc/nginx/sites-available/mysite content should match "access_log /var/www/mysite/doc_access.log;"
     ✔  File /etc/nginx/sites-available/mysite content should match "error_log /var/www/mysite/doc_error.log;"
     ✔  File /etc/nginx/sites-available/mysite content should match "root /var/www/mysite;"
     ✔  Service nginx should be enabled
     ✔  Service nginx should be running
     ✔  System Package nginx should be installed
     ✔  Group www-data should exist
     ✔  User www-data should exist
     ✔  File /etc/nginx/sites-available/mysite should be file
     ✔  File /etc/nginx/sites-available/mysite content should match "listen 80;"
     ✔  File /etc/nginx/sites-available/mysite content should match "server_name docs.mydomain.com default;"
     ✔  File /etc/nginx/sites-available/mysite content should match "access_log /var/www/mysite/doc_access.log;"
     ✔  File /etc/nginx/sites-available/mysite content should match "error_log /var/www/mysite/doc_error.log;"
     ✔  File /etc/nginx/sites-available/mysite content should match "root /var/www/mysite;"
     ✔  Service nginx should be enabled
     ✔  Service nginx should be running


Target:  ssh://kitchen@localhost:32785

     No tests executed.

Profile Summary: 1 successful, 0 failures, 0 skipped
Test Summary: 22 successful, 0 failures, 0 skipped
       Finished verifying <default-centos-72> (0m1.24s).
-----> Kitchen is finished. (0m4.86s)

Tools version

chef -v
Chef Development Kit Version: 1.0.3
chef-client version: 12.16.42
delivery version: master (83358fb62c0f711c70ad5a81030a6cae4017f103)
berks version: 5.2.0
kitchen version: 1.13.2

Inspect version

chef gem list | grep inspec
debug_inspector (0.0.2)
inspec (1.9.0, 1.4.1)
kitchen-inspec (0.17.0, 0.16.1)

Kitchen configuration

---
driver:
  name: docker
  use_sudo: false
  privileged: true

provisioner:
  name: chef_zero

verifier: inspec

platforms:
  - name: centos-7.2
    driver:
      platform: rhel
      run_command: /usr/lib/systemd/systemd
      provision_command:
        - /bin/yum install -y iniscripts net-tools wget
suites:
  - name: default
    run_list:
      - recipe[nginx::default]
    verifier:
      inspec_tests:
        - test/integration/default/inspec/
    attributes:

Inspec the host

When I inspec the target host the inspec output is the right one.

inspec exec test/integration/default/inspec -t ssh://centos@10.0.10.10 -i $HOME/key.pem

Target:  ssh://centos@10.0.10.10:22

  ✔  When OS is Redhat Nginx:: Nginx service need to be installed and configured
     ✔  System Package nginx should be installed
     ✔  Group www-data should exist
     ✔  User www-data should exist
     ✔  File /etc/nginx/sites-available/mysite should be file
     ✔  File /etc/nginx/sites-available/mysite content should match "listen 80;"
     ✔  File /etc/nginx/sites-available/mysite content should match "server_name docs.mydomain.com default;"
     ✔  File /etc/nginx/sites-available/mysite content should match "access_log /var/www/mysite/doc_access.log;"
     ✔  File /etc/nginx/sites-available/mysite content should match "error_log /var/www/mysite/doc_error.log;"
     ✔  File /etc/nginx/sites-available/mysite content should match "root /var/www/mysite;"
     ✔  Service nginx should be enabled
     ✔  Service nginx should be running

So I think the issue is with the kitchen plugin or docker but I am not sure about it? Any suggestions or ideas?

Robert
  • 10,403
  • 14
  • 67
  • 117

1 Answers1

1

This happens if test_base_path is different from, but does include the path you specify under verifier.

You will notice that

kitchen verify docker
-----> Starting Kitchen (v1.18.0)
-----> Verifying <base-centos-73-docker>...
   Loaded tests from {:path=>"<...>/test/integration/base"} 
   Loaded tests from test/integration/base 

actually loads two paths, which are the same.

Calling

kitchen verify -t null docker
-----> Starting Kitchen (v1.18.0)
-----> Verifying <base-centos-73-docker>...
   Loaded tests from test/integration/base 

fixes the issue provided that there is no "path" null on the system.