<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wg-wrap.git/internal/namespace/bootstrap_test.go, branch main</title>
<subtitle>wg-wrap runs commands in network namespaces configured with userspace wireguard tunnels.
</subtitle>
<id>https://git.theodohertyfamily.com/wg-wrap.git/atom?h=main</id>
<link rel='self' href='https://git.theodohertyfamily.com/wg-wrap.git/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.theodohertyfamily.com/wg-wrap.git/'/>
<updated>2026-06-13T15:51:04Z</updated>
<entry>
<title>refactor: implement dependency injection and enable parallel testing</title>
<updated>2026-06-13T15:51:04Z</updated>
<author>
<name>James O'Doherty</name>
<email>james@theodohertyfamily.com</email>
</author>
<published>2026-06-13T15:51:04Z</published>
<link rel='alternate' type='text/html' href='https://git.theodohertyfamily.com/wg-wrap.git/commit/?id=29621ecbd1e77e6e1a70b6b3ea8fbe3a56e47df3'/>
<id>urn:sha1:29621ecbd1e77e6e1a70b6b3ea8fbe3a56e47df3</id>
<content type='text'>
This commit refactors the core system operations to use a manager-based
dependency injection pattern, eliminating global state and resolving
data races in the test suite.

Architecture:
- Introduced NetworkManager and NetworkOps interface in internal/network
  to abstract netlink calls.
- Introduced MountOps and FileSystem interfaces in internal/namespace
  to abstract mount and filesystem operations.
- Introduced TunnelManager in internal/wireguard to coordinate tunnel
  lifecycle using the new abstractions.
- Updated internal/cli and internal/manager to use these managers.

Testing:
- Restored t.Parallel() to unit tests in internal/network and
  internal/wireguard.
- Implemented setupParallelEnv and an enhanced mockFS in
  wireguard_unit_test.go to ensure complete test isolation.
- Added bootstrap_test.go to verify launcher preparation logic in
  internal/namespace without requiring syscall.Exec.
- Resolved data races in internal/network tests.

CLI:
- Added support for -h, --help, and -help flags for the main command.

Verification:
- Passed all tests (unit, integration, E2E).
- Verified zero data races with 'go test -race'.
- Passed golangci-lint and go vet.
</content>
</entry>
</feed>
