summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/aliases/ipv6_spec.rb14
-rwxr-xr-xspec/functions/validate_ipv6_address_spec.rb10
2 files changed, 22 insertions, 2 deletions
diff --git a/spec/aliases/ipv6_spec.rb b/spec/aliases/ipv6_spec.rb
index 13d7c3e..6237eba 100644
--- a/spec/aliases/ipv6_spec.rb
+++ b/spec/aliases/ipv6_spec.rb
@@ -5,7 +5,14 @@ if Puppet.version.to_f >= 4.5
describe 'accepts ipv6 addresses' do
[
'2001:0db8:85a3:0000:0000:8a2e:0370:7334',
- 'fa76:8765:34ac:0823:ab76:eee9:0987:1111'
+ 'fa76:8765:34ac:0823:ab76:eee9:0987:1111',
+ 'fe80:0000:0000:0000:0204:61ff:fe9d:f156',
+ 'fe80:0:0:0:204:61ff:fe9d:f156',
+ 'fe80::204:61ff:fe9d:f156',
+ 'fe80:0:0:0:0204:61ff:254.157.241.86',
+ '::1',
+ 'fe80::',
+ '2001::',
].each do |value|
describe value.inspect do
let(:params) {{ value: value }}
@@ -18,7 +25,10 @@ if Puppet.version.to_f >= 4.5
'nope',
'77',
'4.4.4',
- '2000:7334'
+ '2000:7334',
+ '::ffff:2.3.4',
+ '::ffff:257.1.2.3',
+ '::ffff:12345678901234567890.1.26',
].each do |value|
describe value.inspect do
let(:params) {{ value: value }}
diff --git a/spec/functions/validate_ipv6_address_spec.rb b/spec/functions/validate_ipv6_address_spec.rb
index 78810d4..137db36 100755
--- a/spec/functions/validate_ipv6_address_spec.rb
+++ b/spec/functions/validate_ipv6_address_spec.rb
@@ -29,6 +29,13 @@ describe 'validate_ipv6_address' do
it { is_expected.to run.with_params('3ffe:0505:0002::', '3ffe:0505:0002::2') }
it { is_expected.to run.with_params('::1/64') }
it { is_expected.to run.with_params('fe80::a00:27ff:fe94:44d6/64') }
+ it { is_expected.to run.with_params('fe80:0000:0000:0000:0204:61ff:fe9d:f156') }
+ it { is_expected.to run.with_params('fe80:0:0:0:204:61ff:fe9d:f156') }
+ it { is_expected.to run.with_params('fe80::204:61ff:fe9d:f156') }
+ it { is_expected.to run.with_params('fe80:0:0:0:0204:61ff:254.157.241.86') }
+ it { is_expected.to run.with_params('::1') }
+ it { is_expected.to run.with_params('fe80::') }
+ it { is_expected.to run.with_params('2001::') }
end
describe 'invalid inputs' do
@@ -38,6 +45,9 @@ describe 'validate_ipv6_address' do
it { is_expected.to run.with_params('0.0.0').and_raise_error(Puppet::ParseError, /is not a valid IPv6/) }
it { is_expected.to run.with_params('0.0.0.256').and_raise_error(Puppet::ParseError, /is not a valid IPv6/) }
it { is_expected.to run.with_params('0.0.0.0.0').and_raise_error(Puppet::ParseError, /is not a valid IPv6/) }
+ it { is_expected.to run.with_params('::ffff:2.3.4').and_raise_error(Puppet::ParseError, /is not a valid IPv6/) }
+ it { is_expected.to run.with_params('::ffff:257.1.2.3').and_raise_error(Puppet::ParseError, /is not a valid IPv6/) }
+ it { is_expected.to run.with_params('::ffff:12345678901234567890.1.26').and_raise_error(Puppet::ParseError, /is not a valid IPv6/) }
it { is_expected.to run.with_params('affe:beef').and_raise_error(Puppet::ParseError, /is not a valid IPv6/) }
it { is_expected.to run.with_params('::1', {}).and_raise_error(Puppet::ParseError, /is not a string/) }
it { is_expected.to run.with_params('::1', true).and_raise_error(Puppet::ParseError, /is not a string/) }