Skip to content

Commit

Permalink
added test to check that ethN.MM syntax is correct (i.e. vlan ID is l…
Browse files Browse the repository at this point in the history
…ower than 4096)
  • Loading branch information
Davide Ferrari committed Mar 27, 2015
1 parent c3e6179 commit a0ed4c4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions spec/unit/provider/network_config/interfaces_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,23 @@ def fixture_data(file)
)
end

let(:eth1_4500_provider) do
stub('eth1_4500_provider',
:name => "eth1.4500",
:ensure => :present,
:onboot => true,
:hotplug => true,
:family => "inet",
:method => "dhcp",
:ipaddress => nil,
:netmask => nil,
:mtu => nil,
:mode => :vlan,
:options => {},
)
end


let(:eth1_provider) do
stub('eth1_provider',
:name => "eth1",
Expand Down Expand Up @@ -317,6 +334,13 @@ def fixture_data(file)
end
end

describe "writing wrong vlan iface blocks" do
let(:content) { described_class.format_file('', [eth1_4500_provider]) }
it "should fail with wrong VLAN ID" do
expect { content }.to raise_error(Puppet::Error, /Interface eth1.4500: missing vlan-raw-device or wrong VLAN ID in the iface name/)
end
end

describe "writing the options section" do
let(:content) { described_class.format_file('', [eth1_provider]) }

Expand Down

0 comments on commit a0ed4c4

Please sign in to comment.