diff --git a/spec/configuration/network_spec.rb b/spec/configuration/network_spec.rb index a31a9dc..3f3f312 100644 --- a/spec/configuration/network_spec.rb +++ b/spec/configuration/network_spec.rb @@ -22,7 +22,12 @@ describe 'Management network' do it 'The Management network should contain an IP' do - expect(ip).to match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/) + expect(ip).to match( + /\A(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\. + (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\. + (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\. + (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\z/x + ) end end @@ -30,7 +35,13 @@ describe 'Sync network' do sync = command('ip addr show').stdout it 'Have a network sync' do - interfaces_with_ip = sync.scan(/inet\s+(\d+\.\d+\.\d+\.\d+)/).flatten + interfaces_with_ip = sync.scan( + /inet\s+ + (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\. + (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\. + (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\. + (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/x + ).flatten expect(interfaces_with_ip.length).to be >= 3 puts "OUTPUT: #{interfaces_with_ip}" end