使用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输出是正确的。
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
所以我认为问题出在厨房插件或码头工具上,但我不确定呢?有什么建议或想法吗?
答案 0 :(得分: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
修复了问题,前提是系统上没有“path”null。