Skip to content

Unit spec flakes#2690

Merged
beyhan merged 2 commits intomainfrom
unit-spec-flakes
Mar 19, 2026
Merged

Unit spec flakes#2690
beyhan merged 2 commits intomainfrom
unit-spec-flakes

Conversation

@aramprice
Copy link
Member

No description provided.

The 'should create a subnet spec with restricted_ips in cidr format'
test was flaky because the reserved IP ranges overlapped with the
gateway, network ID, broadcast, and director IP addresses. The
production code's `reject!` block (manual_network_subnet.rb:72-77)
mutates a Set while iterating over it to remove IPs subsumed by
larger CIDRs, which produces non-deterministic results when there
are overlapping entries.

Fix by choosing reserved ranges (10.0.3.64-99, 10.0.3.200-215) and
a director IP (10.0.3.150) that don't overlap with the gateway,
network ID, or broadcast addresses. This makes the reject! a no-op,
and the expected set now explicitly lists all 8 restricted IPs.

Addresses: https://github.com/cloudfoundry/bosh/actions/runs/21680616777

ai-assisted=yes
[TNZ-60576]

Made-with: Cursor
The 'clears similar ips with smaller prefix' test was flaky because
the reserved range 192.168.1.0-12 decomposed into CIDRs where the
saved IP (192.168.1.8/32) overlapped with a reserved CIDR
(192.168.1.8/30). The production code's `reject!` block
(ip_repo.rb:99-104) mutates a Set while iterating to remove IPs
subsumed by larger CIDRs, producing non-deterministic results
depending on Set iteration order.

Fix by using a reserved range (192.168.1.2-31) that doesn't overlap
with the gateway (192.168.1.1) or network ID, and a saved IP
(192.168.1.20) that falls cleanly within a single reserved CIDR
(192.168.1.16/28). The expected next available IP is now
192.168.1.32.

Addresses: https://github.com/cloudfoundry/bosh/actions/runs/22188553905

ai-assisted=yes
[TNZ-60576]

Made-with: Cursor
@aramprice aramprice requested review from a team, neddp and selzoc and removed request for a team March 12, 2026 22:21
@aramprice
Copy link
Member Author

@neddp - tagging you in case this is relevant to #2676

@neddp
Copy link
Member

neddp commented Mar 17, 2026

This could be related to the WIP fix for IP allocation in #2657

@beyhan beyhan merged commit 4828dbe into main Mar 19, 2026
19 checks passed
@github-project-automation github-project-automation bot moved this from Pending Merge | Prioritized to Done in Foundational Infrastructure Working Group Mar 19, 2026
@beyhan beyhan deleted the unit-spec-flakes branch March 19, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

4 participants