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

Restores vm name uniqueness. #399

Merged
merged 1 commit into from
May 2, 2019
Merged
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
52 changes: 26 additions & 26 deletions spec/kitchen/driver/vagrant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1269,9 +1269,9 @@ def run_command(_cmd, options = {})
it "sets :name for virtualbox GUI" do
cmd

expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
expect(vagrantfile).to match(Regexp.new(<<-RUBY.gsub(/^ {8}/, "").chomp))
c.vm.provider :virtualbox do |p|
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99"
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.customize ["modifyvm", :id, "--audio", "none"]
end
RUBY
Expand Down Expand Up @@ -1300,9 +1300,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 :virtualbox do |p|
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99"
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.customize ["modifyvm", :id, "--audio", "none"]
p.customize ["modifyvm", :id, "--a_key", "some value"]
p.customize ["modifyvm", :id, "--something", "else"]
Expand All @@ -1321,9 +1321,9 @@ def run_command(_cmd, options = {})
config[:gui] = false
cmd

expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
expect(vagrantfile).to match(Regexp.new(<<-RUBY.gsub(/^ {8}/, "").chomp))
c.vm.provider :virtualbox do |p|
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99"
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.gui = false
p.customize ["modifyvm", :id, "--audio", "none"]
end
Expand All @@ -1334,9 +1334,9 @@ def run_command(_cmd, options = {})
config[:gui] = true
cmd

expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
expect(vagrantfile).to match(Regexp.new(<<-RUBY.gsub(/^ {8}/, "").chomp))
c.vm.provider :virtualbox do |p|
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99"
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.gui = true
p.customize ["modifyvm", :id, "--audio", "none"]
end
Expand All @@ -1355,9 +1355,9 @@ def run_command(_cmd, options = {})
config[:linked_clone] = false
cmd

expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
expect(vagrantfile).to match(Regexp.new(<<-RUBY.gsub(/^ {8}/, "").chomp))
c.vm.provider :virtualbox do |p|
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99"
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.linked_clone = false
p.customize ["modifyvm", :id, "--audio", "none"]
end
Expand All @@ -1368,9 +1368,9 @@ def run_command(_cmd, options = {})
config[:linked_clone] = true
cmd

expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
expect(vagrantfile).to match(Regexp.new(<<-RUBY.gsub(/^ {8}/, "").chomp))
c.vm.provider :virtualbox do |p|
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99"
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.linked_clone = true
p.customize ["modifyvm", :id, "--audio", "none"]
end
Expand All @@ -1386,9 +1386,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 :virtualbox do |p|
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99"
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.customize ["modifyvm", :id, "--audio", "none"]
p.customize ["createhd", "--filename", "./d1.vmdk", "--size", 10240]
end
Expand All @@ -1410,9 +1410,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 :virtualbox do |p|
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99"
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.customize ["modifyvm", :id, "--audio", "none"]
p.customize ["createhd", "--filename", "./d1.vmdk", "--size", 10240]
p.customize ["createhd", "--filename", "./d2.vmdk", "--size", 20480]
Expand All @@ -1431,9 +1431,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 :virtualbox do |p|
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99"
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.customize ["modifyvm", :id, "--audio", "none"]
p.customize ["storagectl", :id, "--name", "Custom SATA Controller", "--add", "sata", "--controller", "IntelAHCI", "--portcount", 4]
end
Expand All @@ -1456,9 +1456,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 :virtualbox do |p|
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99"
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.customize ["modifyvm", :id, "--audio", "none"]
p.customize ["storagectl", :id, "--name", "Custom SATA Controller", "--add", "sata", "--controller", "IntelAHCI"]
p.customize ["storagectl", :id, "--name", "Custom SATA Controller", "--portcount", 4]
Expand All @@ -1475,9 +1475,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 :virtualbox do |p|
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99"
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.customize ["modifyvm", :id, "--audio", "none"]
p.customize ["storageattach", :id, "--type", "hdd", "--port", 1]
end
Expand Down Expand Up @@ -1505,9 +1505,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 :virtualbox do |p|
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99"
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.customize ["modifyvm", :id, "--audio", "none"]
p.customize ["storageattach", :id, "--storagectl", "SATA Controller", "--port", 1, "--device", 0, "--type", "hdd", "--medium", "./d1.vmdk"]
p.customize ["storageattach", :id, "--storagectl", "SATA Controller", "--port", 1, "--device", 1, "--type", "hdd", "--medium", "./d2.vmdk"]
Expand All @@ -1521,9 +1521,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 :virtualbox do |p|
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99"
p.name = "kitchen-#{File.basename(config[:kitchen_root])}-suitey-fooos-99-.*"
p.customize ["modifyvm", :id, "--audio", "none"]
p.customize ["modifyvm", :id, "--cpuidset", "00000001", "00000002"]
end
Expand Down
4 changes: 2 additions & 2 deletions templates/Vagrantfile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Vagrant.configure("2") do |c|
c.vm.provider :<%= config[:provider] %> do |p|
<% case config[:provider]
when "virtualbox" %>
p.name = "kitchen-<%= File.basename(config[:kitchen_root]) %>-<%= instance.name %>"
p.name = "kitchen-<%= File.basename(config[:kitchen_root]) %>-<%= instance.name %>-<%= SecureRandom.uuid %>"
<% end %>

<% case config[:provider]
Expand All @@ -108,7 +108,7 @@ Vagrant.configure("2") do |c|
p.linked_clone = <%= config[:linked_clone] %>
<% end
when "hyperv" %>
p.vmname = "kitchen-<%= File.basename(config[:kitchen_root]) %>-<%= instance.name %>"
p.vmname = "kitchen-<%= File.basename(config[:kitchen_root]) %>-<%= instance.name %>-<%= SecureRandom.uuid %>"
<% if config[:linked_clone] == true || config[:linked_clone] == false %>
p.linked_clone = <%= config[:linked_clone] %>
<% end
Expand Down