1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
require 'spec_helper'
describe 'get_ext_net_name' do
it 'exists' do
is_expected.not_to eq(nil)
end
it 'fails with no arguments' do
is_expected.to run.with_params.and_raise_error(Puppet::ParseError)
end
it 'should return the network name that has router_ext enabled' do
param = {
"net04" => {
"L2" => {
"router_ext" => false,
}
},
"net04_ext" => {
"L2" => {
"router_ext" => true,
}
}
}
is_expected.to run.with_params(param).and_return('net04_ext')
end
it 'should return nil if router_ext is not enabled' do
param = {
"net04" => {
"L2" => {
"router_ext" => false,
}
},
"net04_ext" => {
"L2" => {
"router_ext" => false,
}
}
}
is_expected.to run.with_params(param).and_return(nil)
end
it 'should return nil if there is no router_ext' do
param = {
"net04" => {
"L2" => {}
},
"net04_ext" => {
"L2" => {}
}
}
is_expected.to run.with_params(param).and_return(nil)
end
it 'should return nil with empty network data' do
param = {}
is_expected.to run.with_params(param).and_return(nil)
end
end
|