From 184999051798cafda685d23268e4deb7ecef8890 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 18 Jul 2016 21:31:25 -0400 Subject: [PATCH] Fix tests --- .../coreos/cap/change_host_name_test.rb | 10 +-- .../darwin/cap/change_host_name_test.rb | 10 +-- .../debian/cap/change_host_name_test.rb | 4 +- .../plugins/guests/debian/cap/rsync_test.rb | 14 +--- .../omnios/cap/change_host_name_test.rb | 4 +- .../photon/cap/change_host_name_test.rb | 4 +- .../guests/pld/cap/change_host_name_test.rb | 4 +- .../redhat/cap/change_host_name_test.rb | 7 +- .../redhat/cap/configure_networks_test.rb | 14 ---- .../slackware/cap/change_host_name_test.rb | 4 +- .../guests/suse/cap/change_host_name_test.rb | 4 +- .../ubuntu/cap/change_host_name_test.rb | 42 ----------- .../guests/arch/network_static_test.rb | 6 +- .../guests/fedora/network_dhcp_test.rb | 21 ------ .../guests/fedora/network_static6_test.rb | 25 ------- .../guests/fedora/network_static_test.rb | 71 ------------------- .../guests/gentoo/network_dhcp_test.rb | 4 +- .../guests/gentoo/network_static_test.rb | 20 +++--- .../guests/redhat/network_dhcp_test.rb | 4 +- .../guests/redhat/network_static_test.rb | 18 ++--- 20 files changed, 55 insertions(+), 235 deletions(-) delete mode 100644 test/unit/plugins/guests/ubuntu/cap/change_host_name_test.rb delete mode 100644 test/unit/templates/guests/fedora/network_dhcp_test.rb delete mode 100644 test/unit/templates/guests/fedora/network_static6_test.rb delete mode 100644 test/unit/templates/guests/fedora/network_static_test.rb diff --git a/test/unit/plugins/guests/coreos/cap/change_host_name_test.rb b/test/unit/plugins/guests/coreos/cap/change_host_name_test.rb index e29d52aa5..8d9603c2d 100644 --- a/test/unit/plugins/guests/coreos/cap/change_host_name_test.rb +++ b/test/unit/plugins/guests/coreos/cap/change_host_name_test.rb @@ -20,17 +20,17 @@ describe "VagrantPlugins::GuestCoreOS::Cap::ChangeHostName" do end describe ".change_host_name" do - let(:hostname) { "banana-rama.example.com" } + let(:name) { "banana-rama.example.com" } it "sets the hostname" do - comm.stub_command("hostname --fqdn | grep -w '#{hostname}'", exit_code: 1) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1) comm.expect_command("hostname 'banana-rama'") - described_class.change_host_name(machine, hostname) + described_class.change_host_name(machine, name) end it "does not change the hostname if already set" do - comm.stub_command("hostname --fqdn | grep -w '#{hostname}'", exit_code: 0) - described_class.change_host_name(machine, hostname) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 0) + described_class.change_host_name(machine, name) expect(comm.received_commands.size).to eq(1) end end diff --git a/test/unit/plugins/guests/darwin/cap/change_host_name_test.rb b/test/unit/plugins/guests/darwin/cap/change_host_name_test.rb index 8852817fa..e92479eaf 100644 --- a/test/unit/plugins/guests/darwin/cap/change_host_name_test.rb +++ b/test/unit/plugins/guests/darwin/cap/change_host_name_test.rb @@ -20,11 +20,11 @@ describe "VagrantPlugins::GuestDarwin::Cap::ChangeHostName" do end describe ".change_host_name" do - let(:hostname) { "banana-rama.example.com" } + let(:name) { "banana-rama.example.com" } it "sets the hostname" do - comm.stub_command("hostname -f | grep -w '#{hostname}' || hostname -s | grep -w '#{hostname}'", exit_code: 1) - described_class.change_host_name(machine, hostname) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1) + described_class.change_host_name(machine, name) expect(comm.received_commands[1]).to match(/scutil --set ComputerName 'banana-rama.example.com'/) expect(comm.received_commands[1]).to match(/scutil --set HostName 'banana-rama.example.com'/) expect(comm.received_commands[1]).to match(/scutil --set LocalHostName 'banana-rama'/) @@ -32,8 +32,8 @@ describe "VagrantPlugins::GuestDarwin::Cap::ChangeHostName" do end it "does not change the hostname if already set" do - comm.stub_command("hostname -f | grep -w '#{hostname}' || hostname -s | grep -w '#{hostname}'", exit_code: 0) - described_class.change_host_name(machine, hostname) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 0) + described_class.change_host_name(machine, name) expect(comm.received_commands.size).to eq(1) end end diff --git a/test/unit/plugins/guests/debian/cap/change_host_name_test.rb b/test/unit/plugins/guests/debian/cap/change_host_name_test.rb index faa3b6935..dee94a67c 100644 --- a/test/unit/plugins/guests/debian/cap/change_host_name_test.rb +++ b/test/unit/plugins/guests/debian/cap/change_host_name_test.rb @@ -27,9 +27,7 @@ describe "VagrantPlugins::GuestDebian::Cap::ChangeHostName" do comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1) cap.change_host_name(machine, name) expect(comm.received_commands[1]).to match(/hostname -F \/etc\/hostname/) - expect(comm.received_commands[1]).to match(/invoke-rc.d hostname.sh start/) - expect(comm.received_commands[1]).to match(/invoke-rc.d networking force-reload/) - expect(comm.received_commands[1]).to match(/invoke-rc.d network-manager force-reload/) + expect(comm.received_commands[1]).to match(/hostname.sh start/) end it "does not set the hostname if unset" do diff --git a/test/unit/plugins/guests/debian/cap/rsync_test.rb b/test/unit/plugins/guests/debian/cap/rsync_test.rb index 753a9ab16..9cf9dccab 100644 --- a/test/unit/plugins/guests/debian/cap/rsync_test.rb +++ b/test/unit/plugins/guests/debian/cap/rsync_test.rb @@ -20,19 +20,11 @@ describe "VagrantPlugins::GuestDebian::Cap:RSync" do end describe ".rsync_install" do - it "installs rsync when not installed" do - comm.stub_command("command -v rsync", exit_code: 1) + it "installs rsync" do described_class.rsync_install(machine) - expect(comm.received_commands[1]).to match(/apt-get -yqq update/) - expect(comm.received_commands[1]).to match(/apt-get -yqq install rsync/) - end - - it "does not install rsync when installed" do - comm.stub_command("command -v rsync", exit_code: 0) - described_class.rsync_install(machine) - - expect(comm.received_commands.join("")).to_not match(/update/) + expect(comm.received_commands[0]).to match(/apt-get -yqq update/) + expect(comm.received_commands[0]).to match(/apt-get -yqq install rsync/) end end end diff --git a/test/unit/plugins/guests/omnios/cap/change_host_name_test.rb b/test/unit/plugins/guests/omnios/cap/change_host_name_test.rb index 1ad9fb4c9..c4afed849 100644 --- a/test/unit/plugins/guests/omnios/cap/change_host_name_test.rb +++ b/test/unit/plugins/guests/omnios/cap/change_host_name_test.rb @@ -24,7 +24,7 @@ describe "VagrantPlugins::GuestOmniOS::Cap:RSync" do let(:name) { "banana-rama.example.com" } it "sets the hostname if unset" do - comm.stub_command("hostname | grep -w '#{name}'", exit_code: 1) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1) cap.change_host_name(machine, name) expect(comm.received_commands[1]).to match(/echo '#{name}' > \/etc\/nodename/) @@ -32,7 +32,7 @@ describe "VagrantPlugins::GuestOmniOS::Cap:RSync" do end it "does not set the hostname if set" do - comm.stub_command("hostname | grep -w '#{name}'", exit_code: 0) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 0) cap.change_host_name(machine, name) expect(comm.received_commands.size).to eq(1) diff --git a/test/unit/plugins/guests/photon/cap/change_host_name_test.rb b/test/unit/plugins/guests/photon/cap/change_host_name_test.rb index 39634aec2..581c9bd77 100644 --- a/test/unit/plugins/guests/photon/cap/change_host_name_test.rb +++ b/test/unit/plugins/guests/photon/cap/change_host_name_test.rb @@ -26,7 +26,7 @@ describe "VagrantPlugins::GuestPhoton::Cap::ChangeHostName" do let(:name) { "banana-rama.example.com" } it "sets the hostname" do - comm.stub_command("hostname -f | grep -w '#{name}'", exit_code: 1) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1) cap.change_host_name(machine, name) expect(comm.received_commands[1]).to match(/echo '#{name}' > \/etc\/hostname/) @@ -34,7 +34,7 @@ describe "VagrantPlugins::GuestPhoton::Cap::ChangeHostName" do end it "does not change the hostname if already set" do - comm.stub_command("hostname -f | grep -w '#{name}'", exit_code: 0) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 0) cap.change_host_name(machine, name) expect(comm.received_commands.size).to eq(1) end diff --git a/test/unit/plugins/guests/pld/cap/change_host_name_test.rb b/test/unit/plugins/guests/pld/cap/change_host_name_test.rb index 75af68d6f..beb46bae8 100644 --- a/test/unit/plugins/guests/pld/cap/change_host_name_test.rb +++ b/test/unit/plugins/guests/pld/cap/change_host_name_test.rb @@ -24,14 +24,14 @@ describe "VagrantPlugins::GuestPld::Cap::ChangeHostName" do let(:name) { "banana-rama.example.com" } it "sets the hostname" do - comm.stub_command("hostname | grep -w '#{name}'", exit_code: 1) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1) cap.change_host_name(machine, name) expect(comm.received_commands[1]).to match(/hostname '#{name}'/) end it "does not change the hostname if already set" do - comm.stub_command("hostname | grep -w '#{name}'", exit_code: 0) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 0) cap.change_host_name(machine, name) expect(comm.received_commands.size).to eq(1) end diff --git a/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb b/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb index 84da01b20..766293545 100644 --- a/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb +++ b/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb @@ -24,17 +24,18 @@ describe "VagrantPlugins::GuestRedHat::Cap::ChangeHostName" do let(:name) { "banana-rama.example.com" } it "sets the hostname" do - comm.stub_command("hostname -f | grep -w '#{name}'", exit_code: 1) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1) cap.change_host_name(machine, name) expect(comm.received_commands[1]).to match(/\/etc\/sysconfig\/network/) expect(comm.received_commands[1]).to match(/\/etc\/sysconfig\/network-scripts\/ifcfg/) - expect(comm.received_commands[1]).to match(/hostnamectl set-hostname '#{name}'/) + expect(comm.received_commands[1]).to match(/hostnamectl set-hostname --static '#{name}'/) + expect(comm.received_commands[1]).to match(/hostnamectl set-hostname --transient '#{name}'/) expect(comm.received_commands[1]).to match(/service network restart/) end it "does not change the hostname if already set" do - comm.stub_command("hostname -f | grep -w '#{name}'", exit_code: 0) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 0) cap.change_host_name(machine, name) expect(comm.received_commands.size).to eq(1) end diff --git a/test/unit/plugins/guests/redhat/cap/configure_networks_test.rb b/test/unit/plugins/guests/redhat/cap/configure_networks_test.rb index 284fe3580..1da032e88 100644 --- a/test/unit/plugins/guests/redhat/cap/configure_networks_test.rb +++ b/test/unit/plugins/guests/redhat/cap/configure_networks_test.rb @@ -49,20 +49,6 @@ describe "VagrantPlugins::GuestRedHat::Cap::ConfigureNetworks" do } end - it "uses fedora for rhel7 configuration" do - require_relative "../../../../../../plugins/guests/fedora/cap/configure_networks" - - allow(guest).to receive(:capability) - .with(:flavor) - .and_return(:rhel_7) - allow(VagrantPlugins::GuestFedora::Cap::ConfigureNetworks) - .to receive(:configure_networks) - - expect(VagrantPlugins::GuestFedora::Cap::ConfigureNetworks) - .to receive(:configure_networks).once - cap.configure_networks(machine, [network_1, network_2]) - end - it "creates and starts the networks" do allow(guest).to receive(:capability) .with(:flavor) diff --git a/test/unit/plugins/guests/slackware/cap/change_host_name_test.rb b/test/unit/plugins/guests/slackware/cap/change_host_name_test.rb index 2c128fc61..e4c20ca0b 100644 --- a/test/unit/plugins/guests/slackware/cap/change_host_name_test.rb +++ b/test/unit/plugins/guests/slackware/cap/change_host_name_test.rb @@ -24,7 +24,7 @@ describe "VagrantPlugins::GuestSlackware::Cap::ChangeHostName" do let(:name) { "banana-rama.example.com" } it "sets the hostname" do - comm.stub_command("hostname -f | grep -w '#{name}'", exit_code: 1) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1) cap.change_host_name(machine, name) expect(comm.received_commands[1]).to match(/echo '#{name}' > \/etc\/hostname/) @@ -32,7 +32,7 @@ describe "VagrantPlugins::GuestSlackware::Cap::ChangeHostName" do end it "does not change the hostname if already set" do - comm.stub_command("hostname -f | grep -w '#{name}'", exit_code: 0) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 0) cap.change_host_name(machine, name) expect(comm.received_commands.size).to eq(1) end diff --git a/test/unit/plugins/guests/suse/cap/change_host_name_test.rb b/test/unit/plugins/guests/suse/cap/change_host_name_test.rb index 9001614d1..1ff565006 100644 --- a/test/unit/plugins/guests/suse/cap/change_host_name_test.rb +++ b/test/unit/plugins/guests/suse/cap/change_host_name_test.rb @@ -24,7 +24,7 @@ describe "VagrantPlugins::GuestSUSE::Cap::ChangeHostName" do let(:name) { "banana-rama.example.com" } it "sets the hostname" do - comm.stub_command("hostname -f | grep -w '#{name}'", exit_code: 1) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1) cap.change_host_name(machine, name) expect(comm.received_commands[1]).to match(/echo '#{name}' > \/etc\/HOSTNAME/) @@ -32,7 +32,7 @@ describe "VagrantPlugins::GuestSUSE::Cap::ChangeHostName" do end it "does not change the hostname if already set" do - comm.stub_command("hostname -f | grep -w '#{name}'", exit_code: 0) + comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 0) cap.change_host_name(machine, name) expect(comm.received_commands.size).to eq(1) end diff --git a/test/unit/plugins/guests/ubuntu/cap/change_host_name_test.rb b/test/unit/plugins/guests/ubuntu/cap/change_host_name_test.rb deleted file mode 100644 index d184ad9cb..000000000 --- a/test/unit/plugins/guests/ubuntu/cap/change_host_name_test.rb +++ /dev/null @@ -1,42 +0,0 @@ -require_relative "../../../../base" - -describe "VagrantPlugins::GuestUbuntu::Cap::ChangeHostName" do - let(:caps) do - VagrantPlugins::GuestUbuntu::Plugin - .components - .guest_capabilities[:ubuntu] - end - - let(:machine) { double("machine") } - let(:comm) { VagrantTests::DummyCommunicator::Communicator.new(machine) } - - before do - allow(machine).to receive(:communicate).and_return(comm) - end - - after do - comm.verify_expectations! - end - - describe ".change_host_name" do - let(:cap) { caps.get(:change_host_name) } - - let(:name) { 'banana-rama.example.com' } - - it "sets the hostname if not set" do - comm.stub_command("hostname -f | grep -w '#{name}'", exit_code: 1) - cap.change_host_name(machine, name) - expect(comm.received_commands[1]).to match(/hostname -F \/etc\/hostname/) - expect(comm.received_commands[1]).to match(/\/etc\/init.d\/hostname.sh start/) - expect(comm.received_commands[1]).to match(/\/etc\/init.d\/hostname start/) - expect(comm.received_commands[1]).to match(/\/etc\/init.d\/networking force-reload/) - expect(comm.received_commands[1]).to match(/\/etc\/init.d\/network-manager force-reload/) - end - - it "does not set the hostname if unset" do - comm.stub_command("hostname -f | grep -w '#{name}'", exit_code: 0) - cap.change_host_name(machine, name) - expect(comm.received_commands.size).to eq(1) - end - end -end diff --git a/test/unit/templates/guests/arch/network_static_test.rb b/test/unit/templates/guests/arch/network_static_test.rb index fb3251d3b..d6f156ebc 100644 --- a/test/unit/templates/guests/arch/network_static_test.rb +++ b/test/unit/templates/guests/arch/network_static_test.rb @@ -7,8 +7,9 @@ describe "templates/guests/arch/network_static" do it "renders the template" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - device: "eth1", - ip: "1.1.1.1", + device: "eth1", + ip: "1.1.1.1", + netmask: "24", }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") Connection=ethernet @@ -24,6 +25,7 @@ describe "templates/guests/arch/network_static" do device: "eth1", ip: "1.1.1.1", gateway: "1.2.3.4", + netmask: "24", }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") Connection=ethernet diff --git a/test/unit/templates/guests/fedora/network_dhcp_test.rb b/test/unit/templates/guests/fedora/network_dhcp_test.rb deleted file mode 100644 index b257aa76e..000000000 --- a/test/unit/templates/guests/fedora/network_dhcp_test.rb +++ /dev/null @@ -1,21 +0,0 @@ -require_relative "../../../base" - -require "vagrant/util/template_renderer" - -describe "templates/guests/fedora/network_dhcp" do - let(:template) { "guests/fedora/network_dhcp" } - - it "renders the template" do - result = Vagrant::Util::TemplateRenderer.render(template, options: { - device: "en0", - }) - expect(result).to eq <<-EOH.gsub(/^ {6}/, "") - #VAGRANT-BEGIN - # The contents below are automatically generated by Vagrant. Do not modify. - BOOTPROTO=dhcp - ONBOOT=yes - DEVICE=en0 - #VAGRANT-END - EOH - end -end diff --git a/test/unit/templates/guests/fedora/network_static6_test.rb b/test/unit/templates/guests/fedora/network_static6_test.rb deleted file mode 100644 index bcd4076eb..000000000 --- a/test/unit/templates/guests/fedora/network_static6_test.rb +++ /dev/null @@ -1,25 +0,0 @@ -require_relative "../../../base" - -require "vagrant/util/template_renderer" - -describe "templates/guests/fedora/network_static6" do - let(:template) { "guests/fedora/network_static6" } - - it "renders the template" do - result = Vagrant::Util::TemplateRenderer.render(template, options: { - device: "en0", - ip: "fc00::10/64" - }) - expect(result).to eq <<-EOH.gsub(/^ {6}/, "") - #VAGRANT-BEGIN - # The contents below are automatically generated by Vagrant. Do not modify. - NM_CONTROLLED=no - BOOTPROTO=static - ONBOOT=yes - IPV6INIT=yes - IPV6ADDR=fc00::10/64 - DEVICE=en0 - #VAGRANT-END - EOH - end -end diff --git a/test/unit/templates/guests/fedora/network_static_test.rb b/test/unit/templates/guests/fedora/network_static_test.rb deleted file mode 100644 index f6e879fa2..000000000 --- a/test/unit/templates/guests/fedora/network_static_test.rb +++ /dev/null @@ -1,71 +0,0 @@ -require_relative "../../../base" - -require "vagrant/util/template_renderer" - -describe "templates/guests/fedora/network_static" do - let(:template) { "guests/fedora/network_static" } - - it "renders the template" do - result = Vagrant::Util::TemplateRenderer.render(template, options: { - device: "en0", - ip: "1.1.1.1", - netmask: "255.255.0.0", - }) - expect(result).to eq <<-EOH.gsub(/^ {6}/, "") - #VAGRANT-BEGIN - # The contents below are automatically generated by Vagrant. Do not modify. - NM_CONTROLLED=no - BOOTPROTO=none - ONBOOT=yes - IPADDR=1.1.1.1 - NETMASK=255.255.0.0 - DEVICE=en0 - PEERDNS=no - #VAGRANT-END - EOH - end - - it "includes the gateway" do - result = Vagrant::Util::TemplateRenderer.render(template, options: { - device: "en0", - ip: "1.1.1.1", - netmask: "255.255.0.0", - gateway: "1.2.3.4", - }) - expect(result).to eq <<-EOH.gsub(/^ {6}/, "") - #VAGRANT-BEGIN - # The contents below are automatically generated by Vagrant. Do not modify. - NM_CONTROLLED=no - BOOTPROTO=none - ONBOOT=yes - IPADDR=1.1.1.1 - NETMASK=255.255.0.0 - DEVICE=en0 - GATEWAY=1.2.3.4 - PEERDNS=no - #VAGRANT-END - EOH - end - - it "includes the mac_address" do - result = Vagrant::Util::TemplateRenderer.render(template, options: { - device: "en0", - ip: "1.1.1.1", - netmask: "255.255.0.0", - mac_address: "abcd1234", - }) - expect(result).to eq <<-EOH.gsub(/^ {6}/, "") - #VAGRANT-BEGIN - # The contents below are automatically generated by Vagrant. Do not modify. - NM_CONTROLLED=no - BOOTPROTO=none - ONBOOT=yes - IPADDR=1.1.1.1 - NETMASK=255.255.0.0 - DEVICE=en0 - HWADDR=abcd1234 - PEERDNS=no - #VAGRANT-END - EOH - end -end diff --git a/test/unit/templates/guests/gentoo/network_dhcp_test.rb b/test/unit/templates/guests/gentoo/network_dhcp_test.rb index 7885c2acc..8126c6d58 100644 --- a/test/unit/templates/guests/gentoo/network_dhcp_test.rb +++ b/test/unit/templates/guests/gentoo/network_dhcp_test.rb @@ -7,12 +7,12 @@ describe "templates/guests/gentoo/network_dhcp" do it "renders the template" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - interface: "en0", + device: "en0", }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") #VAGRANT-BEGIN # The contents below are automatically generated by Vagrant. Do not modify. - config_ethen0="dhcp" + config_en0="dhcp" #VAGRANT-END EOH end diff --git a/test/unit/templates/guests/gentoo/network_static_test.rb b/test/unit/templates/guests/gentoo/network_static_test.rb index e1eb8ce1a..74c394480 100644 --- a/test/unit/templates/guests/gentoo/network_static_test.rb +++ b/test/unit/templates/guests/gentoo/network_static_test.rb @@ -7,30 +7,30 @@ describe "templates/guests/gentoo/network_static" do it "renders the template" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - interface: "en0", - ip: "1.1.1.1", - netmask: "255.255.0.0", + device: "en0", + ip: "1.1.1.1", + netmask: "255.255.0.0", }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") #VAGRANT-BEGIN # The contents below are automatically generated by Vagrant. Do not modify. - config_ethen0=("1.1.1.1 netmask 255.255.0.0") + config_en0=("1.1.1.1 netmask 255.255.0.0") #VAGRANT-END EOH end it "includes the gateway" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - interface: "en0", - ip: "1.1.1.1", - netmask: "255.255.0.0", - gateway: "1.2.3.4", + device: "en0", + ip: "1.1.1.1", + netmask: "255.255.0.0", + gateway: "1.2.3.4", }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") #VAGRANT-BEGIN # The contents below are automatically generated by Vagrant. Do not modify. - config_ethen0=("1.1.1.1 netmask 255.255.0.0") - gateways_ethen0="1.2.3.4" + config_en0=("1.1.1.1 netmask 255.255.0.0") + gateways_en0="1.2.3.4" #VAGRANT-END EOH end diff --git a/test/unit/templates/guests/redhat/network_dhcp_test.rb b/test/unit/templates/guests/redhat/network_dhcp_test.rb index 280678a2f..505869c28 100644 --- a/test/unit/templates/guests/redhat/network_dhcp_test.rb +++ b/test/unit/templates/guests/redhat/network_dhcp_test.rb @@ -7,14 +7,14 @@ describe "templates/guests/redhat/network_dhcp" do it "renders the template" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - interface: "en0", + device: "en0", }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") #VAGRANT-BEGIN # The contents below are automatically generated by Vagrant. Do not modify. BOOTPROTO=dhcp ONBOOT=yes - DEVICE=ethen0 + DEVICE=en0 #VAGRANT-END EOH end diff --git a/test/unit/templates/guests/redhat/network_static_test.rb b/test/unit/templates/guests/redhat/network_static_test.rb index 443ec2d56..6260878ea 100644 --- a/test/unit/templates/guests/redhat/network_static_test.rb +++ b/test/unit/templates/guests/redhat/network_static_test.rb @@ -7,9 +7,9 @@ describe "templates/guests/redhat/network_static" do it "renders the template" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - interface: "en0", - ip: "1.1.1.1", - netmask: "255.255.0.0", + device: "en0", + ip: "1.1.1.1", + netmask: "255.255.0.0", }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") #VAGRANT-BEGIN @@ -19,7 +19,7 @@ describe "templates/guests/redhat/network_static" do ONBOOT=yes IPADDR=1.1.1.1 NETMASK=255.255.0.0 - DEVICE=ethen0 + DEVICE=en0 PEERDNS=no #VAGRANT-END EOH @@ -27,10 +27,10 @@ describe "templates/guests/redhat/network_static" do it "includes the gateway" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - interface: "en0", - ip: "1.1.1.1", - gateway: "1.2.3.4", - netmask: "255.255.0.0", + device: "en0", + ip: "1.1.1.1", + gateway: "1.2.3.4", + netmask: "255.255.0.0", }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") #VAGRANT-BEGIN @@ -40,7 +40,7 @@ describe "templates/guests/redhat/network_static" do ONBOOT=yes IPADDR=1.1.1.1 NETMASK=255.255.0.0 - DEVICE=ethen0 + DEVICE=en0 GATEWAY=1.2.3.4 PEERDNS=no #VAGRANT-END