29ab657707
* Fixes in the l23 module's ruby liraries Change-Id: Ib08c1c81255bdbdf557bfdf48f2ad409bbd8957a Related-Bug: 1586480
31 lines
847 B
Ruby
31 lines
847 B
Ruby
require 'spec_helper'
|
|
|
|
describe 'cidr_to_netmask' do
|
|
|
|
it 'should exist' do
|
|
is_expected.not_to be_nil
|
|
end
|
|
|
|
it 'should throw an error on invalid types' do
|
|
is_expected.to run.with_params({:foo => :bar}).and_raise_error(Puppet::ParseError)
|
|
end
|
|
|
|
it 'should throw an error on invalid CIDR' do
|
|
invalid_cidrs = ['192.168.33.66', '192.256.33.66/23', 'jhgjhgghggh']
|
|
for cidr in invalid_cidrs
|
|
is_expected.to run.with_params(cidr).and_raise_error(Puppet::ParseError)
|
|
end
|
|
end
|
|
|
|
it 'should throw an error on invalid CIDR masklen' do
|
|
cidr = '192.168.33.66/33'
|
|
is_expected.to run.with_params(cidr).and_raise_error(Puppet::ParseError)
|
|
end
|
|
|
|
it 'should return netmask from CIDR' do
|
|
cidr = '192.168.33.66/25'
|
|
netmask = '255.255.255.128'
|
|
is_expected.to run.with_params(cidr).and_return(netmask)
|
|
end
|
|
end
|