
Fixes the validation to enforce the following condition. - Vlan id should not be 0 or a negative value - Single vlan id is never accepted. Both min and max should be set Change-Id: I5335df96c3d1967841673c25fc427e9a0b9a9735
40 lines
1.0 KiB
Ruby
40 lines
1.0 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe 'validate_network_vlan_ranges' do
|
|
it 'exists' do
|
|
is_expected.not_to eq(nil)
|
|
end
|
|
|
|
context 'with valid values' do
|
|
[
|
|
# only physnet
|
|
'datecentre',
|
|
# physnet:<min>:<max>
|
|
'datecentre:1:100',
|
|
'datecentre:100:100', # min = max should be accepted
|
|
# array
|
|
['datacentre', 'datacentre2:1:100'],
|
|
].each do |value|
|
|
it { is_expected.to run.with_params(value) }
|
|
end
|
|
end
|
|
|
|
context 'with invalid values' do
|
|
[
|
|
'', # empty string
|
|
'1:100', # missing physnet
|
|
'datecentre:1:', # missing max
|
|
'datecentre::100', # missing min
|
|
'datecentre:a:100', # min is not integer
|
|
'datecentre:1:b', # max is not integer
|
|
'datecentre:1', # not enough fields
|
|
'datecentre:1:100:1000', # too many fields
|
|
'datecentre:1:4095', # max is too large
|
|
'datecentre:0:4094', # min is too small
|
|
'datecentre:101:100', # min > max
|
|
].each do |value|
|
|
it { is_expected.to run.with_params(value).and_raise_error(Puppet::Error) }
|
|
end
|
|
end
|
|
end
|