forked from sous-chefs/docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers_network_spec.rb
49 lines (41 loc) · 1.12 KB
/
helpers_network_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require 'rspec'
require_relative '../libraries/helpers_network'
describe Class.new { include DockerCookbook::DockerHelpers::Network } do
subject(:helper) { Class.new { include DockerCookbook::DockerHelpers::Network } }
let(:subnets) do
%w(
192.168.0.0/24
)
end
let(:ip_ranges) do
%w(
192.168.0.31/28
)
end
let(:gateways) do
%w(
192.168.0.34
)
end
let(:aux_addresses) do
%w(
foo=192.168.0.34
bar=192.168.0.124
)
end
describe '#consolidate_ipam' do
subject { described_class.new.consolidate_ipam(subnets, ip_ranges, gateways, aux_addresses) }
it 'should have a subnet' do
expect(subject).to include(include('Subnet' => '192.168.0.0/24'))
end
it 'should have aux address' do
expect(subject).to include(include('AuxiliaryAddresses' => { 'foo' => '192.168.0.34', 'bar' => '192.168.0.124' }))
end
it 'should have gateways' do
expect(subject).to include(include('Gateway' => '192.168.0.34'))
end
it 'should have ip range' do
expect(subject).to include(include('IPRange' => '192.168.0.31/28'))
end
end
end