summaryrefslogtreecommitdiff
path: root/spec/aliases
diff options
context:
space:
mode:
authorHelen Campbell <helen@puppetlabs.com>2016-08-16 11:55:05 +0100
committerHelen Campbell <helen@puppetlabs.com>2016-08-17 13:49:42 +0100
commit6d185bdaa19f698270a0df4b0a0c05618864b955 (patch)
tree2d005f4664838214a4e3284e73a2060453a1216c /spec/aliases
parent1d9d2c02d6669d4a6219140ae7ff3648a30c89cf (diff)
Deprecation of ip functions
Diffstat (limited to 'spec/aliases')
-rw-r--r--spec/aliases/ip_address.rb34
-rw-r--r--spec/aliases/ipv4_spec.rb32
-rw-r--r--spec/aliases/ipv6_spec.rb30
3 files changed, 96 insertions, 0 deletions
diff --git a/spec/aliases/ip_address.rb b/spec/aliases/ip_address.rb
new file mode 100644
index 0000000..036bfe5
--- /dev/null
+++ b/spec/aliases/ip_address.rb
@@ -0,0 +1,34 @@
+require 'spec_helper'
+
+if Puppet.version.to_f >= 4.0
+ describe 'test::ip_address', type: :class do
+ describe 'accepts ipv4 and ipv6 addresses' do
+ [
+ '224.0.0.0',
+ '255.255.255.255',
+ '0.0.0.0',
+ '192.88.99.0',
+ '2001:0db8:85a3:0000:0000:8a2e:0370:7334',
+ 'fa76:8765:34ac:0823:ab76:eee9:0987:1111'
+ ].each do |value|
+ describe value.inspect do
+ let(:params) {{ value: value }}
+ it { is_expected.to compile }
+ end
+ end
+ end
+ describe 'rejects other values' do
+ [
+ 'nope',
+ '77',
+ '4.4.4',
+ '2001:0db8:85a3:000000:0000:8a2e:0370:7334'
+ ].each do |value|
+ describe value.inspect do
+ let(:params) {{ value: value }}
+ it { is_expected.to compile.and_raise_error(/parameter 'value' expects a match for/) }
+ end
+ end
+ end
+ end
+end
diff --git a/spec/aliases/ipv4_spec.rb b/spec/aliases/ipv4_spec.rb
new file mode 100644
index 0000000..640618c
--- /dev/null
+++ b/spec/aliases/ipv4_spec.rb
@@ -0,0 +1,32 @@
+require 'spec_helper'
+
+if Puppet.version.to_f >= 4.0
+ describe 'test::ipv4', type: :class do
+ describe 'accepts ipv4 addresses' do
+ [
+ '224.0.0.0',
+ '255.255.255.255',
+ '0.0.0.0',
+ '192.88.99.0'
+ ].each do |value|
+ describe value.inspect do
+ let(:params) {{ value: value }}
+ it { is_expected.to compile }
+ end
+ end
+ end
+ describe 'rejects other values' do
+ [
+ 'nope',
+ '77',
+ '4.4.4',
+ '2001:0db8:85a3:0000:0000:8a2e:0370:73342001:0db8:85a3:0000:0000:8a2e:0370:7334'
+ ].each do |value|
+ describe value.inspect do
+ let(:params) {{ value: value }}
+ it { is_expected.to compile.and_raise_error(/parameter 'value' expects a match for Stdlib::Compat::Ipv4/) }
+ end
+ end
+ end
+ end
+end
diff --git a/spec/aliases/ipv6_spec.rb b/spec/aliases/ipv6_spec.rb
new file mode 100644
index 0000000..688eb16
--- /dev/null
+++ b/spec/aliases/ipv6_spec.rb
@@ -0,0 +1,30 @@
+require 'spec_helper'
+
+if Puppet.version.to_f >= 4.0
+ describe 'test::ipv6', type: :class do
+ describe 'accepts ipv6 addresses' do
+ [
+ '2001:0db8:85a3:0000:0000:8a2e:0370:7334',
+ 'fa76:8765:34ac:0823:ab76:eee9:0987:1111'
+ ].each do |value|
+ describe value.inspect do
+ let(:params) {{ value: value }}
+ it { is_expected.to compile }
+ end
+ end
+ end
+ describe 'rejects other values' do
+ [
+ 'nope',
+ '77',
+ '4.4.4',
+ '2000:7334'
+ ].each do |value|
+ describe value.inspect do
+ let(:params) {{ value: value }}
+ it { is_expected.to compile.and_raise_error(/parameter 'value' expects a match for Stdlib::Compat::Ipv6/) }
+ end
+ end
+ end
+ end
+end