Skip to content

Conversation

@rich7420
Copy link
Contributor

@rich7420 rich7420 commented Jan 30, 2026

Description

Document how to run tests when Docker works and when make test fails (e.g. WSL + Docker Desktop credential helper).

  • building-from-source.md: Testing section — make test; Option 1: fix Docker config (backup/clear ~/.docker/config.json); Option 2: run without Docker (unit, envtest, validate). Version reference table (envtest K8s, envtest tool, Go/builder) — use Makefile values, not latest.
  • AGENTS.md: Same flow under "Running tests when Docker is unavailable or credential helper fails": fix Docker (WSL) or run without Docker; version note.

Related Issues

Closes #939

Checklist

Note: Ensure your PR title follows the Conventional Commits format (e.g., feat(scheduler): add new feature)

  • Self-reviewed
  • Added/updated tests (if needed)
  • Updated documentation (if needed)

Breaking Changes

Additional Notes

Summary by CodeRabbit

Documentation

  • Added comprehensive testing guide with setup instructions and Docker troubleshooting steps
  • Provided alternative test commands for environments without Docker
  • Included Kubernetes version reference information for testing

@gshaibi
Copy link
Collaborator

gshaibi commented Feb 9, 2026

@CodeRabbit full review

@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

Walkthrough

Documentation was added to two files explaining how to run tests when Docker credential helper failures occur, particularly in WSL environments. This includes Docker configuration fixes and alternative commands for running unit and integration tests without Docker.

Changes

Cohort / File(s) Summary
Testing Documentation
AGENTS.md, docs/developer/building-from-source.md
Added comprehensive testing guidance covering Docker credential helper troubleshooting for WSL, Docker configuration fixes, and alternate test commands (envtest) that bypass Docker dependency. Includes Kubernetes version reference information.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A rabbit hops through testing grounds,
No Docker walls need still be found,
With envtest flags, we run and play,
Tests pass in WSL's lighter way! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'docs: document running tests when Docker credential helper fails (e.g. WSL)' clearly and specifically summarizes the main change in the pull request, which is documenting how to run tests when Docker credential helper issues occur.
Description check ✅ Passed The PR description provides a clear overview of changes, references the related issue (#939), includes a completed checklist, and explains both documentation changes (building-from-source.md and AGENTS.md) with specific details about test options and version reference tables.
Linked Issues check ✅ Passed The pull request comprehensively addresses all coding and documentation requirements from issue #939: documents the Docker credential helper failure scenario, provides clear instructions for fixing Docker config or running tests without Docker, and includes version reference information for test tools.
Out of Scope Changes check ✅ Passed All changes are focused on documentation (AGENTS.md and building-from-source.md) directly addressing the requirements in issue #939, with no unrelated modifications present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@AGENTS.md`:
- Around line 54-58: Reword the unit test instruction to clarify that the short
test command excludes envtest-dependent packages (e.g., change to "Unit tests
(excludes envtest-dependent packages): go test ./pkg/... ./cmd/... -count=1
-short") and replace the hardcoded "1.34.0" in the bin/setup-envtest example
with a placeholder or reference to the ENVTEST_K8S_VERSION value from
build/makefile/testenv.mk (e.g., use "<VERSION>" or a note to substitute
ENVTEST_K8S_VERSION) so the example uses the canonical version variable instead
of a literal; update the example invocation that calls bin/setup-envtest to
reflect this placeholder.
- Around line 49-51: The current step that runs `echo '{}' >
~/.docker/config.json` dangerously overwrites the entire Docker config; instead
preserve other keys by updating the instruction to remove only the credsStore
field (keep the existing backup step `cp ~/.docker/config.json
~/.docker/config.json.bak`) and either: (a) use a safe JSON-editing tool (e.g.,
jq) to delete the top-level "credsStore" property and write the result back to
~/.docker/config.json, or (b) instruct users to manually remove the "credsStore"
line from their config and verify important keys like "auths", "proxies", and
"experimental" are retained; replace the destructive `echo '{}' >
~/.docker/config.json` line in AGENTS.md accordingly.

In `@docs/developer/building-from-source.md`:
- Around line 54-58: Update the unit test line to clarify intent by explaining
it runs only unit tests and skips envtest-dependent integration tests (e.g.,
change the phrasing around `go test ./pkg/... ./cmd/... -count=1 -short` to say
"Unit tests only (skips envtest integration tests)"). Also replace the hardcoded
`1.34.0` in the envtest example with a placeholder like `<ENVTEST_K8S_VERSION>`
and add a short note to fetch the actual version from `ENVTEST_K8S_VERSION` in
`build/makefile/testenv.mk` when running the `make envtest` /
`bin/setup-envtest` commands so the docs stay correct if the Makefile version
changes.
🧹 Nitpick comments (1)
docs/developer/building-from-source.md (1)

62-70: Version reference table is helpful; consider simplifying Go/builder row.

The table clearly documents version sources, which is valuable. The Go/builder row references two locations (build/makefile/golang.mk and build/builder/Dockerfile), which may require users to check multiple files. If both always contain the same version, consider noting that or pointing to a single authoritative source.

Comment on lines +49 to +51
cp ~/.docker/config.json ~/.docker/config.json.bak
echo '{}' > ~/.docker/config.json
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Risk: Docker config overwrite may lose other settings beyond credsStore.

The command echo '{}' > ~/.docker/config.json replaces the entire Docker configuration file, not just the credsStore field. Users may have other important settings in this file (e.g., auths for registry credentials, proxies, experimental flags, detachKeys, etc.) that will be lost.

🛡️ Safer alternative using jq
-cp ~/.docker/config.json ~/.docker/config.json.bak
-echo '{}' > ~/.docker/config.json
+cp ~/.docker/config.json ~/.docker/config.json.bak
+jq 'del(.credsStore)' ~/.docker/config.json > ~/.docker/config.json.tmp && mv ~/.docker/config.json.tmp ~/.docker/config.json

This preserves other Docker settings while removing only the problematic credsStore field. Alternatively, document that users should manually edit the file to remove just the credsStore line, or verify they have no other important settings before using the destructive approach.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cp ~/.docker/config.json ~/.docker/config.json.bak
echo '{}' > ~/.docker/config.json
```
cp ~/.docker/config.json ~/.docker/config.json.bak
jq 'del(.credsStore)' ~/.docker/config.json > ~/.docker/config.json.tmp && mv ~/.docker/config.json.tmp ~/.docker/config.json
🤖 Prompt for AI Agents
In `@AGENTS.md` around lines 49 - 51, The current step that runs `echo '{}' >
~/.docker/config.json` dangerously overwrites the entire Docker config; instead
preserve other keys by updating the instruction to remove only the credsStore
field (keep the existing backup step `cp ~/.docker/config.json
~/.docker/config.json.bak`) and either: (a) use a safe JSON-editing tool (e.g.,
jq) to delete the top-level "credsStore" property and write the result back to
~/.docker/config.json, or (b) instruct users to manually remove the "credsStore"
line from their config and verify important keys like "auths", "proxies", and
"experimental" are retained; replace the destructive `echo '{}' >
~/.docker/config.json` line in AGENTS.md accordingly.

Comment on lines +54 to +58
- **Without Docker:** Unit: `go test ./pkg/... ./cmd/... -count=1 -short` (exit 1 if envtest packages fail). Integration: use `ENVTEST_K8S_VERSION` from `build/makefile/testenv.mk` (not `latest`):
```bash
make envtest
KUBEBUILDER_ASSETS="$(bin/setup-envtest use 1.34.0 -p path --bin-dir bin)" go test ./pkg/... -timeout 30m
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Clarify "exit 1" expectation and consider version variable.

Two points:

  1. The phrase "exit 1 if envtest packages fail" may confuse users—why document a command expected to partially fail? Consider rephrasing to: "Unit tests (excludes envtest-dependent packages): go test ./pkg/... ./cmd/... -count=1 -short" or clarify that -short skips integration tests that require envtest.

  2. The example hardcodes version 1.34.0 even though line 54 instructs users to check ENVTEST_K8S_VERSION from build/makefile/testenv.mk. This could lead to version drift if the Makefile is updated but documentation is not. Consider using a placeholder like <VERSION> with a note to substitute the actual value, or accept the maintenance trade-off.

🤖 Prompt for AI Agents
In `@AGENTS.md` around lines 54 - 58, Reword the unit test instruction to clarify
that the short test command excludes envtest-dependent packages (e.g., change to
"Unit tests (excludes envtest-dependent packages): go test ./pkg/... ./cmd/...
-count=1 -short") and replace the hardcoded "1.34.0" in the bin/setup-envtest
example with a placeholder or reference to the ENVTEST_K8S_VERSION value from
build/makefile/testenv.mk (e.g., use "<VERSION>" or a note to substitute
ENVTEST_K8S_VERSION) so the example uses the canonical version variable instead
of a literal; update the example invocation that calls bin/setup-envtest to
reflect this placeholder.

Comment on lines +54 to +58
- Unit tests: `go test ./pkg/... ./cmd/... -count=1 -short` (envtest-dependent packages may fail; exit 1 is expected).
- Integration (envtest): use `ENVTEST_K8S_VERSION` from `build/makefile/testenv.mk` (e.g. 1.34.0; do not use `latest`):
```sh
make envtest
KUBEBUILDER_ASSETS="$(bin/setup-envtest use 1.34.0 -p path --bin-dir bin)" go test ./pkg/... -timeout 30m
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Clarify unit test expectations and version hardcoding.

Two minor points:

  1. "exit 1 is expected": This phrasing suggests the command will fail, which may confuse users. Consider clarifying that -short skips integration tests requiring envtest, so some packages won't be tested: "Unit tests only (skips envtest integration tests): go test ./pkg/... ./cmd/... -count=1 -short".

  2. Hardcoded version 1.34.0: Line 55 directs users to build/makefile/testenv.mk for ENVTEST_K8S_VERSION, yet the example hardcodes 1.34.0. If the Makefile is updated, this documentation will become stale. Consider using <VERSION> as a placeholder, or accept the maintenance cost for the sake of a working copy-paste example.

🤖 Prompt for AI Agents
In `@docs/developer/building-from-source.md` around lines 54 - 58, Update the unit
test line to clarify intent by explaining it runs only unit tests and skips
envtest-dependent integration tests (e.g., change the phrasing around `go test
./pkg/... ./cmd/... -count=1 -short` to say "Unit tests only (skips envtest
integration tests)"). Also replace the hardcoded `1.34.0` in the envtest example
with a placeholder like `<ENVTEST_K8S_VERSION>` and add a short note to fetch
the actual version from `ENVTEST_K8S_VERSION` in `build/makefile/testenv.mk`
when running the `make envtest` / `bin/setup-envtest` commands so the docs stay
correct if the Makefile version changes.

@gshaibi
Copy link
Collaborator

gshaibi commented Feb 9, 2026

Hi @rich7420,
Thanks for the PR! I think we can take a simpler approach here.
Rather than documenting workarounds for broken Docker setups, let's just make the prerequisite explicit. building-from-source.md already assumes Docker but never states it. Could you replace this PR with a small Prerequisites section at the top of building-from-source.md listing the required tools (Docker, Go, Helm, etc.)? That covers the gap without us needing to own WSL/Docker troubleshooting.
No changes needed in AGENTS.md — it already documents the direct go test / make envtest commands for anyone who needs them.

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.

docs/ci: Document envtest path when make test fails due to Docker credential helper (WSL/Docker Desktop)

2 participants