0

使用kitchen verify我得到了我的套件测试的双重报告。我不知道为什么,它只发生在这本食谱中。我运行了相同的kitchen verify命令并且输出很清楚,那么现在有什么不同?

它是输出(带有双重报告):

-----> 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)

工具版本

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

检查版本

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)

厨房配置

---
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 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

所以我认为问题出在厨房插件或码头上,但我不确定?有什么建议或想法吗?

4

1 回答 1

1

如果 test_base_path 不同于但确实包含您在验证程序下指定的路径,则会发生这种情况。

你会注意到

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 

实际上加载了两条路径,它们是相同的。

打电话

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

如果系统上没有“路径”空值,则修复该问题。

于 2017-10-06T05:20:18.743 回答