summaryrefslogtreecommitdiff
path: root/spec/aliases/ipv6_spec.rb
diff options
context:
space:
mode:
authorPeter Souter <peter.souter+GIT@puppet.com>2017-03-03 11:43:12 +0000
committerPeter Souter <peter.souter+GIT@puppet.com>2017-03-03 11:45:30 +0000
commit496d19640cc239f59e456c381bd9912cde60a07e (patch)
treebe9b7351d0acee50cb3454fa81f8a09d093f3f4c /spec/aliases/ipv6_spec.rb
parent2fa8b2b6387aa59d8cc10e521e069e02477a186b (diff)
(MODULES-4485) Improve ipv6 support for type
* Improves regex to catch some valid (but less known) ipv6 strings, mostly those which are a mix of ipv6 strings and embedded ipv4 numbers * Regex inspired by the following: * https://github.com/sindresorhus/ip-regex * https://gist.github.com/cpetschnig/294476 * The original Dartware forum thread where someone originally created this beast of a regex, now lost except to archive.org * Whilst we're here, we can add the more tricky ipv6 strings to the existing functions to validate * Luckily, the `ipaddr` native ruby library used in the original functions already supports these
Diffstat (limited to 'spec/aliases/ipv6_spec.rb')
-rw-r--r--spec/aliases/ipv6_spec.rb14
1 files changed, 12 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 }}