Skip to content

Fix unit spec flakes#2681

Merged
aramprice merged 2 commits intomainfrom
fix-unit-spec-flakes
Feb 26, 2026
Merged

Fix unit spec flakes#2681
aramprice merged 2 commits intomainfrom
fix-unit-spec-flakes

Conversation

@aramprice
Copy link
Copy Markdown
Member

@aramprice aramprice commented Feb 26, 2026

Fixes non-determinism in spec expectations using Cursor / claude-4.6-opus-high

This should address most of the recent failures in github actions:
https://github.com/cloudfoundry/bosh/actions/workflows/ruby.yml?query=is%3Afailure+branch%3Amain

Three specs relied on database row ordering that isn't guaranteed
across different DB engines or parallel test runs:

- instance_network_reservations_spec: use contain_exactly instead
  of eq for nic_group assertions since ip_addresses association
  order is non-deterministic
- scan_and_fix_spec: use DeploymentProblem.order(:id) instead of
  .all when indexing by position, since .all doesn't guarantee order
- package_persister_spec: use Package.order(:name) and explicit
  where clause instead of .all with positional indexing

Made-with: Cursor
The test expected deployment names in a specific order in the error
message, but stemcell.deployments returns results in non-deterministic
order. Use a regex matcher to accept either ordering.

Made-with: Cursor
@github-project-automation github-project-automation bot moved this from Inbox to Pending Merge | Prioritized in Foundational Infrastructure Working Group Feb 26, 2026
@aramprice aramprice merged commit e825b10 into main Feb 26, 2026
19 checks passed
@github-project-automation github-project-automation bot moved this from Pending Merge | Prioritized to Done in Foundational Infrastructure Working Group Feb 26, 2026
@aramprice aramprice deleted the fix-unit-spec-flakes branch February 26, 2026 22:26
@beyhan
Copy link
Copy Markdown
Member

beyhan commented Feb 27, 2026

Thank you @aramprice!

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.

3 participants