使用带有vsphere的测试厨房

时间:2018-01-10 21:52:04

标签: chef vsphere test-kitchen

我有一个厨师食谱,当使用厨房在aws上测试时可以使用。 我希望用我们的vsphere集群测试它。 我似乎找不到任何有关如何使这项工作的现代文档。 目前,kitchen create似乎有效,然后进入收敛阶段。

      Finished creating <default-ubuntu-1604> (1m12.66s).
-----> Converging <default-ubuntu-1604>...
       Preparing files for transfer
       Preparing dna.json
       Resolving cookbook dependencies with Berkshelf 6.3.1...
       Removing non-cookbook files before transfer
       Preparing validation.pem
       Preparing client.rb

不幸的是,它只是挂在'准备client.rb'行。我不知道它是否会再次出现或超时,但它至少会持续45分钟。

如果我kitchen converge -l debug,我也会

D      Creating client.rb from {:node_name=>"default-ubuntu-1604", 
:checksum_path=>"/tmp/kitchen/checksums", 
:file_cache_path=>"/tmp/kitchen/cache", 
:file_backup_path=>"/tmp/kitchen/backup", :cookbook_path=>
["/tmp/kitchen/cookbooks", "/tmp/kitchen/site-cookbooks"], 
:data_bag_path=>"/tmp/kitchen/data_bags", 
:environment_path=>"/tmp/kitchen/environments", 
:node_path=>"/tmp/kitchen/nodes", :role_path=>"/tmp/kitchen/roles", 
:client_path=>"/tmp/kitchen/clients", 
:user_path=>"/tmp/kitchen/users", 
:validation_key=>"/tmp/kitchen/validation.pem", 
:client_key=>"/tmp/kitchen/client.pem", 
:chef_server_url=>"http://127.0.0.1:8889", 
:encrypted_data_bag_secret=>"/tmp/kitchen/encrypted_data_bag_secret", 
:treat_deprecation_warnings_as_errors=>false, :named_run_list=>{}}

D      [SSH] 
ubuntu@192.168.21.123<{:user_known_hosts_file=>"/dev/null", 
:paranoid=>false, :port=>22, :compression=>false, 
:compression_level=>0, :keepalive=>true, :keepalive_interval=>60, 
:timeout=>15, :password=>"password"}> (sudo sh -c '

chef_omnibus_root="/opt/chef"
chef_omnibus_url="https://omnitruck.chef.io/install.sh"
install_flags=""
pretty_version="install only if missing"
sudo_sh="sudo sh"
version="true"

<snip a whole bunch of shell script>

main
')

D      [SSH] opening connection to 
ubuntu@192.168.21.123<{:user_known_hosts_file=>"/dev/null", 
:paranoid=>false, :port=>22, :compression=>false, 
:compression_level=>0, :keepalive=>true, :keepalive_interval=>60, 
:timeout=>15, :password=>"password"}>

此后它似乎挂在ssh呼叫上。

这是我的.kitchen.yml文件:

---
driver:
  name: vsphere
  driver_options:
    host: '<redacted>'
    user: '<redacted>'
    password: '<redacted>'
    insecure: true
  machine_options:
    start_timeout: 600
    create_timeout: 600
    ready_timeout: 90
    bootstrap_options:
      use_linked_clone: true
      datacenter: '<redacted>'
      template_name: 'Ubuntu-16.04'
      num_cpus: 2,
      network_name:
        - 'VMNetwork 1'
      memory_mb: 4096
      resource_pool: '<redacted>/DeployTest'
      ssh:
        user: ubuntu
        paranoid: false
        password: password
        port: 22
      convergence_options:
      customization_spec:
        domain: local
        ipsettings:
          dnsServerList:
            - <redacted>
            - 8.8.8.8
            - 8.8.4.4
provisioner:
  name: chef_zero
  # You may wish to disable always updating cookbooks in CI or other testing environments.
  # For example:
  #   always_update_cookbooks: <%= !ENV['CI'] %>
  always_update_cookbooks: false
  sudo_command: sudo

verifier:
  name: inspec

transport:
  user: ubuntu
  password: password

platforms:
  - name: ubuntu-16.04

suites:
  - name: default
    run_list:
      - recipe[hydra-base::default]
    verifier:
      inspec_tests:
        - test/smoke/default
    #attributes:

那么我该怎样做才能解决这个问题呢?谢谢! *编辑:我不知道如何输入

1 个答案:

答案 0 :(得分:0)

本身并不是一个真正的答案,但希望它可以帮助那些遇到同样问题的人。

根据我收到的帮助,我使用的驱动程序(可能)已被弃用。相反,有人建议我使用这个driver 但是,此驱动程序目前存在一些已知问题。根据{{​​3}},第一个可以解决。 vSphere 6.5还有另一个问题。我提交了this wiki entry,作者就是这个案子!