]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Add a test.
authorAlex Harvey <Alex.Harvey@team.telstra.com>
Tue, 29 Mar 2016 15:32:37 +0000 (02:32 +1100)
committerAlex Harvey <Alex.Harvey@team.telstra.com>
Tue, 29 Mar 2016 15:36:44 +0000 (02:36 +1100)
Demonstrate some surprising behaviour to make it clearer that it's
nevertheless working as designed.

spec/unit/puppet/util/ipcidr_spec.rb

index 916f74a350aef974719bd152969ba743780c9147..df73ae536ad5084f0dbda63b3b84d424fd3959e2 100644 (file)
@@ -25,6 +25,16 @@ describe 'Puppet::Util::IPCidr' do
     specify { subject.netmask.should == '255.255.255.0' }
   end
 
+  # https://tickets.puppetlabs.com/browse/MODULES-3215
+  describe 'ipv4 address range with invalid cidr' do
+    before { @ipcidr = Puppet::Util::IPCidr.new('96.126.112.20/24') }
+    subject { @ipcidr }
+    specify { subject.cidr.should == '96.126.112.0/24' }  # .20 is expected to 
+                                                          # be silently dropped.
+    specify { subject.prefixlen.should == 24 }
+    specify { subject.netmask.should == '255.255.255.0' }
+  end
+
   describe 'ipv4 open range with cidr' do
     before { @ipcidr = Puppet::Util::IPCidr.new('0.0.0.0/0') }
     subject { @ipcidr }