From 233120eebda5093dd86fada243b2a6abd1a6bd20 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 6 Jun 2016 12:34:45 -0400 Subject: [PATCH] templates/general: Fix failing tests --- .../guests/arch/network_dhcp_test.rb | 4 +-- .../guests/arch/network_static_test.rb | 8 ++--- .../guests/debian/network_dhcp_test.rb | 12 ++++---- .../guests/debian/network_static_test.rb | 12 ++++---- .../guests/freebsd/network_dhcp_test.rb | 7 +++-- .../guests/freebsd/network_static_test.rb | 30 ++++++++----------- .../guests/suse/network_dhcp_test.rb | 4 +-- .../guests/suse/network_static_test.rb | 8 ++--- 8 files changed, 42 insertions(+), 43 deletions(-) diff --git a/test/unit/templates/guests/arch/network_dhcp_test.rb b/test/unit/templates/guests/arch/network_dhcp_test.rb index 10a3f2c7d..b845eb666 100644 --- a/test/unit/templates/guests/arch/network_dhcp_test.rb +++ b/test/unit/templates/guests/arch/network_dhcp_test.rb @@ -7,11 +7,11 @@ describe "templates/guests/arch/network_dhcp" do it "renders the template" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - device: "en0", + device: "eth1", }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") Description='A basic dhcp ethernet connection' - Interface=en0 + Interface=eth1 Connection=ethernet IP=dhcp EOH diff --git a/test/unit/templates/guests/arch/network_static_test.rb b/test/unit/templates/guests/arch/network_static_test.rb index 375ec67c5..fb3251d3b 100644 --- a/test/unit/templates/guests/arch/network_static_test.rb +++ b/test/unit/templates/guests/arch/network_static_test.rb @@ -7,13 +7,13 @@ describe "templates/guests/arch/network_static" do it "renders the template" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - device: "en0", + device: "eth1", ip: "1.1.1.1", }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") Connection=ethernet Description='A basic static ethernet connection' - Interface=en0 + Interface=eth1 IP=static Address=('1.1.1.1/24') EOH @@ -21,14 +21,14 @@ describe "templates/guests/arch/network_static" do it "includes the gateway" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - device: "en0", + device: "eth1", ip: "1.1.1.1", gateway: "1.2.3.4", }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") Connection=ethernet Description='A basic static ethernet connection' - Interface=en0 + Interface=eth1 IP=static Address=('1.1.1.1/24') Gateway='1.2.3.4' diff --git a/test/unit/templates/guests/debian/network_dhcp_test.rb b/test/unit/templates/guests/debian/network_dhcp_test.rb index a5a0eba8d..e239d2eea 100644 --- a/test/unit/templates/guests/debian/network_dhcp_test.rb +++ b/test/unit/templates/guests/debian/network_dhcp_test.rb @@ -7,13 +7,13 @@ describe "templates/guests/debian/network_dhcp" do it "renders the template" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - device: "en0", + device: "eth1", }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") #VAGRANT-BEGIN # The contents below are automatically generated by Vagrant. Do not modify. - auto eth - iface eth inet dhcp + auto eth1 + iface eth1 inet dhcp post-up route del default dev $IFACE || true #VAGRANT-END EOH @@ -22,14 +22,14 @@ describe "templates/guests/debian/network_dhcp" do context "when use_dhcp_assigned_default_route is set" do it "renders the template" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - device: "en0", + device: "eth1", use_dhcp_assigned_default_route: true, }) expect(result).to eq <<-EOH.gsub(/^ {8}/, "") #VAGRANT-BEGIN # The contents below are automatically generated by Vagrant. Do not modify. - auto eth - iface eth inet dhcp + auto eth1 + iface eth1 inet dhcp # We need to disable eth0, see GH-2648 post-up route del default dev eth0 || true post-up dhclient $IFACE diff --git a/test/unit/templates/guests/debian/network_static_test.rb b/test/unit/templates/guests/debian/network_static_test.rb index 936a6a806..08f9a67af 100644 --- a/test/unit/templates/guests/debian/network_static_test.rb +++ b/test/unit/templates/guests/debian/network_static_test.rb @@ -7,15 +7,15 @@ describe "templates/guests/debian/network_static" do it "renders the template" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - device: "en0", + device: "eth1", 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. - auto eth - iface eth inet static + auto eth1 + iface eth1 inet static address 1.1.1.1 netmask 255.255.0.0 #VAGRANT-END @@ -24,7 +24,7 @@ describe "templates/guests/debian/network_static" do it "includes the gateway" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - device: "en0", + device: "eth1", ip: "1.1.1.1", netmask: "255.255.0.0", gateway: "1.2.3.4", @@ -32,8 +32,8 @@ describe "templates/guests/debian/network_static" do expect(result).to eq <<-EOH.gsub(/^ {6}/, "") #VAGRANT-BEGIN # The contents below are automatically generated by Vagrant. Do not modify. - auto eth - iface eth inet static + auto eth1 + iface eth1 inet static address 1.1.1.1 netmask 255.255.0.0 gateway 1.2.3.4 diff --git a/test/unit/templates/guests/freebsd/network_dhcp_test.rb b/test/unit/templates/guests/freebsd/network_dhcp_test.rb index 322de3746..a3ad5b61c 100644 --- a/test/unit/templates/guests/freebsd/network_dhcp_test.rb +++ b/test/unit/templates/guests/freebsd/network_dhcp_test.rb @@ -6,10 +6,13 @@ describe "templates/guests/freebsd/network_dhcp" do let(:template) { "guests/freebsd/network_dhcp" } it "renders the template" do - result = Vagrant::Util::TemplateRenderer.render(template, ifname: "vtneten0") + result = Vagrant::Util::TemplateRenderer.render(template, options: { + device: "eth1", + }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") #VAGRANT-BEGIN - ifconfig_vtneten0="DHCP" + ifconfig_eth1="DHCP" + synchronous_dhclient="YES" #VAGRANT-END EOH end diff --git a/test/unit/templates/guests/freebsd/network_static_test.rb b/test/unit/templates/guests/freebsd/network_static_test.rb index ca9eb0153..d398a8647 100644 --- a/test/unit/templates/guests/freebsd/network_static_test.rb +++ b/test/unit/templates/guests/freebsd/network_static_test.rb @@ -6,32 +6,28 @@ describe "templates/guests/freebsd/network_static" do let(:template) { "guests/freebsd/network_static" } it "renders the template" do - result = Vagrant::Util::TemplateRenderer.render(template, - ifname: "vtneten0", - options: { - ip: "1.1.1.1", - netmask: "255.255.0.0", - }, - ) + result = Vagrant::Util::TemplateRenderer.render(template, options: { + device: "eth1", + ip: "1.1.1.1", + netmask: "255.255.0.0", + }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") #VAGRANT-BEGIN - ifconfig_vtneten0="inet 1.1.1.1 netmask 255.255.0.0" + ifconfig_eth1="inet 1.1.1.1 netmask 255.255.0.0" #VAGRANT-END EOH end it "includes the gateway" do - result = Vagrant::Util::TemplateRenderer.render(template, - ifname: "vtneten0", - options: { - ip: "1.1.1.1", - netmask: "255.255.0.0", - gateway: "1.2.3.4", - }, - ) + result = Vagrant::Util::TemplateRenderer.render(template, options: { + device: "eth1", + ip: "1.1.1.1", + netmask: "255.255.0.0", + gateway: "1.2.3.4", + }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") #VAGRANT-BEGIN - ifconfig_vtneten0="inet 1.1.1.1 netmask 255.255.0.0" + ifconfig_eth1="inet 1.1.1.1 netmask 255.255.0.0" default_router="1.2.3.4" #VAGRANT-END EOH diff --git a/test/unit/templates/guests/suse/network_dhcp_test.rb b/test/unit/templates/guests/suse/network_dhcp_test.rb index 1ecb4dc1f..bef88433b 100644 --- a/test/unit/templates/guests/suse/network_dhcp_test.rb +++ b/test/unit/templates/guests/suse/network_dhcp_test.rb @@ -7,14 +7,14 @@ describe "templates/guests/suse/network_dhcp" do it "renders the template" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - interface: "en0", + device: "eth0" }) expect(result).to eq <<-EOH.gsub(/^ {6}/, "") #VAGRANT-BEGIN # The contents below are automatically generated by Vagrant. Do not modify. BOOTPROTO='dhcp' STARTMODE='auto' - DEVICE='ethen0' + DEVICE='eth0' #VAGRANT-END EOH end diff --git a/test/unit/templates/guests/suse/network_static_test.rb b/test/unit/templates/guests/suse/network_static_test.rb index 09117268d..b336e6097 100644 --- a/test/unit/templates/guests/suse/network_static_test.rb +++ b/test/unit/templates/guests/suse/network_static_test.rb @@ -7,7 +7,7 @@ describe "templates/guests/suse/network_static" do it "renders the template" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - interface: "en0", + device: "eth1", ip: "1.1.1.1", netmask: "255.255.0.0", }) @@ -17,7 +17,7 @@ describe "templates/guests/suse/network_static" do BOOTPROTO='static' IPADDR='1.1.1.1' NETMASK='255.255.0.0' - DEVICE='ethen0' + DEVICE='eth1' PEERDNS='no' STARTMODE='auto' USERCONTROL='no' @@ -27,7 +27,7 @@ describe "templates/guests/suse/network_static" do it "includes the gateway" do result = Vagrant::Util::TemplateRenderer.render(template, options: { - interface: "en0", + device: "eth1", ip: "1.1.1.1", gateway: "1.2.3.4", netmask: "255.255.0.0", @@ -38,7 +38,7 @@ describe "templates/guests/suse/network_static" do BOOTPROTO='static' IPADDR='1.1.1.1' NETMASK='255.255.0.0' - DEVICE='ethen0' + DEVICE='eth1' GATEWAY='1.2.3.4' PEERDNS='no' STARTMODE='auto'