-
Notifications
You must be signed in to change notification settings - Fork 9
Integrating with Test Kitchen
sax edited this page Dec 17, 2014
·
2 revisions
If box_url
is not set on the driver, ensure that the smartos box is locally installed via vagrant box add
.
---
driver:
name: vagrant
provisioner:
name: chef_zero
require_chef_omnibus: true
platforms:
- name: smartos
driver_config:
box: livinginthepast/smartos-base64
vagrantfile_erb: test/templates/Vagrantfile.smartos.erb
provisioner:
name: chef_zero
nodes_path: test/nodes
environments_path: test/environments
sudo: true
chef_omnibus_url: https://raw.github.com/wanelo-chef/chef-bootstrap/master/latest.sh
client_rb:
environment: my-environment
suites:
- name: master
run_list:
- recipe[my::recipe]
Test Kitchen allows for custom Vagrantfile templates, which are required in order for our vagrant plugin to work. Drop this in test/templates/Vagrantfile.smartos.erb
.
#!/usr/bin/ruby
#^ruby syntax highlighting
Vagrant.configure("2") do |c|
c.vm.box = "<%= config[:box] %>"
c.vm.box_url = "<%= config[:box_url] %>"
c.ssh.insert_key = false
c.vm.communicator = 'smartos'
c.global_zone.platform_image = 'latest'
c.zone.name = 'base64'
c.zone.brand = 'joyent'
c.zone.image = 'd34c301e-10c3-11e4-9b79-5f67ca448df0'
c.zone.memory = 3536
c.zone.disk_size = 5
<% if config[:vm_hostname] %>
c.vm.hostname = "<%= config[:vm_hostname] %>"
<% end %>
<% if config[:guest] %>
c.vm.guest = <%= config[:guest] %>
<% end %>
<% if config[:username] %>
c.ssh.username = "<%= config[:username] %>"
<% end %>
<% if config[:password] %>
c.ssh.password = "<%= config[:password] %>"
<% end %>
<% if config[:ssh_key] %>
c.ssh.private_key_path = "<%= config[:ssh_key] %>"
<% end %>
<% Array(config[:network]).each do |opts| %>
c.vm.network(:<%= opts[0] %>, <%= opts[1..-1].join(", ") %>)
<% end %>
c.vm.synced_folder ".", "/vagrant", disabled: true
<% config[:synced_folders].each do |source, destination, options| %>
c.vm.synced_folder "<%= source %>", "<%= destination %>", <%= options %>
<% end %>
c.vm.provider :<%= config[:provider] %> do |p|
<% config[:customize].each do |key, value| %>
<% case config[:provider]
when "virtualbox" %>
p.customize ["modifyvm", :id, "--<%= key %>", "<%= value %>"]
<% when "rackspace", "softlayer" %>
p.<%= key %> = "<%= value%>"
<% when /^vmware_/ %>
<% if key == :memory %>
<% unless config[:customize].include?(:memsize) %>
p.vmx["memsize"] = "<%= value %>"
<% end %>
<% else %>
p.vmx["<%= key %>"] = "<%= value %>"
<% end %>
<% end %>
<% end %>
end
end