Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Avoid colliding guest names on libvirt when running multiple kit… #495

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions spec/kitchen/driver/vagrant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1619,8 +1619,9 @@ def run_command(_cmd, options = {})
}
cmd

expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
expect(vagrantfile).to match(Regexp.new(<<-RUBY.gsub(/^ {8}/, "").chomp))
c.vm.provider :libvirt do |p|
p.default_prefix = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.a_key = "some value"
p.something = "else"
p.a_number_key = 1024
Expand All @@ -1634,8 +1635,9 @@ def run_command(_cmd, options = {})
}
cmd

expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
expect(vagrantfile).to match(Regexp.new(<<-RUBY.gsub(/^ {8}/, "").chomp))
c.vm.provider :libvirt do |p|
p.default_prefix = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.storage :file, :size => '32G'
end
RUBY
Expand All @@ -1651,8 +1653,9 @@ def run_command(_cmd, options = {})
}
cmd

expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
expect(vagrantfile).to match(Regexp.new(<<-RUBY.gsub(/^ {8}/, "").chomp))
c.vm.provider :libvirt do |p|
p.default_prefix = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.storage :file, :size => '1G'
p.storage :file, :size => '128G', :bus => 'sata'
p.storage :file, :size => '64G', :bus => 'sata'
Expand Down
5 changes: 5 additions & 0 deletions templates/Vagrantfile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ Vagrant.configure("2") do |c|
p.name = "kitchen-<%= File.basename(config[:kitchen_root]) %>-<%= instance.name %>-<%= SecureRandom.uuid %>"
<% end %>

<% case config[:provider]
when "libvirt" %>
p.name = "kitchen-<%= File.basename(config[:kitchen_root]) %>-<%= instance.name %>-<%= SecureRandom.uuid %>"
<% end %>

<% case config[:provider]
when "virtualbox", /^vmware_/
if config[:gui] == true || config[:gui] == false %>
Expand Down