Skip to content

Commit 4828dbe

Browse files
authored
Merge pull request #2690 from cloudfoundry/unit-spec-flakes
Unit spec flakes
2 parents 9f90202 + 3af2463 commit 4828dbe

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

src/bosh-director/spec/unit/bosh/director/deployment_plan/ip_provider/ip_repo_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,12 @@ def save_ip(ip)
290290
end
291291

292292
it 'clears similar ips with smaller prefix' do
293-
network_spec['subnets'].first['reserved'] = ['192.168.1.0 - 192.168.1.12']
293+
network_spec['subnets'].first['reserved'] = ['192.168.1.2 - 192.168.1.31']
294294
network_spec['subnets'].first['range'] = '192.168.1.0/24'
295-
save_ip(cidr_ip('192.168.1.8'))
295+
save_ip(cidr_ip('192.168.1.20'))
296296

297297
ip_address = ip_repo.allocate_dynamic_ip(reservation, subnet)
298-
expected_ip_address = cidr_ip('192.168.1.13')
298+
expected_ip_address = cidr_ip('192.168.1.32')
299299
expect(ip_address).to eq(expected_ip_address)
300300
end
301301
end

src/bosh-director/spec/unit/bosh/director/deployment_plan/manual_network_subnet_spec.rb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,36 @@ def make_managed_subnet(properties, availability_zones)
3232
end
3333

3434
it 'should create a subnet spec with restricted_ips in cidr format' do
35-
allow(Bosh::Director::Config).to receive(:director_ips).and_return([to_ipaddr('10.0.3.11').to_s])
35+
allow(Bosh::Director::Config).to receive(:director_ips).and_return([to_ipaddr('10.0.3.150').to_s])
3636

3737
subnet = make_subnet(
3838
{
3939
'dns' => ['10.0.0.2'],
4040
'gateway' => '10.0.3.1',
4141
'range' => '10.0.3.0/24',
4242
'reserved' => [
43-
'10.0.3.0 - 10.0.3.35',
44-
'10.0.3.242 - 10.0.3.255']
43+
'10.0.3.64 - 10.0.3.99',
44+
'10.0.3.200 - 10.0.3.215']
4545
},
4646
[],
4747
)
4848

49-
expected_restricted_ips = Set.new([to_ipaddr('10.0.3.0/27'), to_ipaddr('10.0.3.32/30'), to_ipaddr('10.0.3.242/31'), to_ipaddr('10.0.3.244/30'), to_ipaddr('10.0.3.248/29') ])
49+
expected_restricted_ips = Set.new([
50+
to_ipaddr('10.0.3.0/32'),
51+
to_ipaddr('10.0.3.1/32'),
52+
to_ipaddr('10.0.3.255/32'),
53+
to_ipaddr('10.0.3.150/32'),
54+
to_ipaddr('10.0.3.64/27'),
55+
to_ipaddr('10.0.3.96/30'),
56+
to_ipaddr('10.0.3.200/29'),
57+
to_ipaddr('10.0.3.208/29'),
58+
])
5059

5160
expect(subnet.range.to_s).to eq('10.0.3.0/24')
5261
expect(subnet.netmask).to eq('255.255.255.0')
5362
expect(subnet.gateway).to eq('10.0.3.1')
5463
expect(subnet.dns).to eq(['10.0.0.2'])
5564
expect(subnet.restricted_ips).to eq(expected_restricted_ips)
56-
5765
end
5866

5967
it 'should create valid subnet spec for managed networks' do

0 commit comments

Comments
 (0)