【问题标题】:kitchen verify output show double test report厨房验证输出显示双重测试报告
【发布时间】:2017-10-06 13:20:18
【问题描述】:

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

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

【问题讨论】:

    标签: chef-recipe cookbook test-kitchen inspec


    【解决方案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 
    

    修复了系统上没有“路径”空值的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-19
      • 1970-01-01
      • 2015-04-24
      • 1970-01-01
      • 2021-02-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多