Skip to content

fix(infra): clean up docker networks on partial create and close failures - #689

Open
AleksaMCode wants to merge 1 commit into
dependabot:mainfrom
AleksaMCode:fix/network-cleanup-on-create-close-failure
Open

AleksaMCode wants to merge 1 commit into
dependabot:mainfrom
AleksaMCode:fix/network-cleanup-on-create-close-failure

Conversation

@AleksaMCode

Copy link
Copy Markdown

This PR fixes a Docker network resource leak in internal/infra/network.go.

  • Added rollback cleanup in NewNetworks:
    • if creating the second network fails, the first created network is removed.
  • Updated Networks.Close() to:
    • attempt removal of both networks regardless of the first failure,
    • return aggregated cleanup errors (errors.Join) instead of failing fast.

I've also included a regression tests for the fix.

@AleksaMCode
AleksaMCode requested review from a team as code owners October 29, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant