Conversation
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Active-context handling has unresolved context-name and TLS/SSH compatibility issues, with missing focused macOS tests.
Review effort: Lite
Findings: None
What changed in this PR
Updates Docker endpoint discovery on macOS to support active contexts and user socket fallbacks.
Changes:
- Adds Docker context inspection and socket fallback logic.
- Applies configuration to Docker clients, ping checks, and dry-run execution.
| File | Summary |
|---|---|
pkg/connectors/container_client.go |
Adds Docker host resolution and client integration. Requires context-name resolution, support for TLS/SSH metadata, focused macOS tests, and gofmt cleanup. |
cmd/testDryRun.go |
Configures the Docker host before dry-run Testcontainers usage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Hey @Harsh4902, Just opened this PR for the macOS Docker context discovery, all CI checks are green. |
84b947b to
31eec2e
Compare
31eec2e to
fa22049
Compare
|
Hi @Harsh4902, Following up from the discussion on #539, I've updated the PR and added unit tests in Lemme know incase i've missed on something. |
| var ( | ||
| currentGOOS = runtime.GOOS | ||
| execCommand = exec.Command | ||
| defaultSocketPath = "/var/run/docker.sock" | ||
| ) |
There was a problem hiding this comment.
Why do we need these extra variables?
There was a problem hiding this comment.
They were added as test hooks so container_client_test.go can mock exec.Command and test the macOS context inspection and socket fallback scenarios on Linux CI runners (without needing a live Docker daemon).
If you'd prefer to keep container_client.go free of package-level test variables and keep the tests simpler, happy to remove them , let me know what u think.
…able Signed-off-by: ish-g09 <ig.valiente09@gmail.com>
fa22049 to
21f7bbd
Compare
Description
ConfigureDockerHostinpkg/connectors/container_client.goto helpmicrocks-cliconnect to Docker on macOS when the default/var/run/docker.sockisn't available.docker context inspectso it honors whatever context the user is actively running (Docker Desktop, Colima, OrbStack, etc.).$HOME/.docker/run/docker.sockif context inspection isn't available.DOCKER_HOSTis already set or if/var/run/docker.sockexists (like on Linux).NewDockerClient(),PingDockerHost(), andcmd/testDryRun.goso bothmicrocks startandmicrocks test --dry-runcan reach Docker smoothly on modern macOS setups.pkg/connectors/container_client_test.gocovering active context resolution, socket fallback, and platform checks.Related issue(s)
Fixes #537
AI Disclosure
The code changes and unit tests were verified by me and I fully understand them. Used AI assistance to help structure unit test cases and mock subprocess patterns.
Testing
go test -v -run TestConfigureDockerHost ./pkg/connectors/...: passes (6/6 tests)go build ./...: passesgo test ./...: all packages pass