Sha256: 130fdb6463c307af8713647a080ea5cfd95a26a0e544f0dd2ece67a10a7e1104
Contents?: true
Size: 1.54 KB
Versions: 6
Compression:
Stored size: 1.54 KB
Contents
require 'spec_helper' module Vcloud describe 'firewall_service_schema_validations' do context 'source and destination ips' do it 'should error if source_ip/destination_ip are invalid IPs' do config = { firewall_rules: [ { id: '999', description: "A rule", destination_port_range: "22", destination_ip: "10.10", source_ip: "192.0", } ] } validator = ConfigValidator.validate(:base, config, Schema::FIREWALL_SERVICE) expect(validator.valid?).to be_false expect(validator.errors).to eq([ "source_ip: 192.0 is not a valid IP address range. Valid values can be IP address, CIDR, IP range, 'Any','internal' and 'external'.", "destination_ip: 10.10 is not a valid IP address range. Valid values can be IP address, CIDR, IP range, 'Any','internal' and 'external'." ]) end it 'should validate OK if source_ip/destination_ip are valid IPs' do config = { firewall_rules: [ { id: '999', description: "A rule", destination_port_range: "22", destination_ip: "10.10.10.20", source_ip: "192.0.2.2", } ] } validator = ConfigValidator.validate(:base, config, Schema::FIREWALL_SERVICE) expect(validator.valid?).to be_true end end end end
Version data entries
6 entries across 6 versions & 1 rubygems