Accept network interface MAC addresses without colon delimiters

Commonly found in other Vagrant providers, a MAC address format without
colon delimiters is now accepted for better cross-compatibility of
Vagrantfiles.
This commit is contained in:
Dominic Cleal
2017-05-16 14:20:44 +01:00
parent 7b968c7a72
commit 404c428036
2 changed files with 16 additions and 3 deletions

View File

@@ -44,8 +44,15 @@ describe VagrantPlugins::ProviderLibvirt::Config do
assert_valid
end
it 'is valid with MAC containing no delimiters' do
network = [:public, { mac: 'aabbccddeeff' }]
expect(vm).to receive(:networks).and_return([network])
assert_valid
expect(network[1][:mac]).to eql('aa:bb:cc:dd:ee:ff')
end
it 'should be invalid if MAC not formatted correctly' do
expect(vm).to receive(:networks).and_return([[:public, { mac: 'aabbccddeeff' }]])
expect(vm).to receive(:networks).and_return([[:public, { mac: 'aa/bb/cc/dd/ee/ff' }]])
assert_invalid
end
end