Skip to content

Commit

Permalink
Merge pull request #184 from gh2k/boot-timeout
Browse files Browse the repository at this point in the history
Add support for boot_timeout driver setting
  • Loading branch information
Seth Thomas committed Jan 16, 2016
2 parents 59ac19a + e2d07f5 commit ff8cb07
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/kitchen/driver/vagrant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class Vagrant < Kitchen::Driver::Base

default_config :box_version, nil

default_config :boot_timeout, nil

default_config :customize, {}

default_config :gui, nil
Expand Down
26 changes: 26 additions & 0 deletions spec/kitchen/driver/vagrant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,16 @@ def run_command(_cmd, options = {})
expect(driver[:box_version]).to eq("1.2.3")
end

it "sets :boot_timeout to nil by default" do
expect(driver[:boot_timeout]).to eq(nil)
end

it "sets :boot_timeout to a custom value" do
config[:boot_timeout] = 600

expect(driver[:boot_timeout]).to eq(600)
end

it "sets :customize to an empty hash by default" do
expect(driver[:customize]).to eq({})
end
Expand Down Expand Up @@ -918,6 +928,22 @@ def run_command(_cmd, options = {})
expect(vagrantfile).to match(regexify(%{c.vm.box_version = "a.b.c"}))
end

it "sets no vm.boot_timeout if missing" do
config[:boot_timeout] = nil
cmd

expect(vagrantfile).to_not match(regexify(%{c.vm.boot_timeout}, :partial))
end

it "sets no vm.boot_timeout if :boot_timeout is set" do
config[:boot_timeout] = 600
cmd

expect(vagrantfile).to match(
regexify(%{c.vm.boot_timeout = 600}, :partial)
)
end

it "sets no vm.box_check_update if missing" do
config[:box_check_update] = nil
cmd
Expand Down
4 changes: 4 additions & 0 deletions templates/Vagrantfile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ Vagrant.configure("2") do |c|
<% end %>
<% end %>

<% if config[:boot_timeout] %>
c.vm.boot_timeout = <%= config[:boot_timeout] %>
<% end %>

<% Array(config[:network]).each do |opts| %>
c.vm.network(:<%= opts[0] %>, <%= opts[1..-1].join(", ") %>)
<% end %>
Expand Down

0 comments on commit ff8cb07

Please sign in to comment.