-
Notifications
You must be signed in to change notification settings - Fork 152
docs: document running tests when Docker credential helper fails (e.g. WSL) #940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,10 +35,29 @@ ginkgo -v --focus "TestHandleAllocation" ./pkg/scheduler/actions/allocate | |
| # Run tests with Ginkgo (for integration tests) | ||
| ginkgo -v --focus "test name pattern" ./pkg/binder/controllers/integration_tests | ||
|
|
||
| # Run tests with envtest (requires setup-envtest) | ||
| # Run tests with envtest (requires setup-envtest; K8s version from build/makefile/testenv.mk ENVTEST_K8S_VERSION) | ||
| make envtest | ||
| KUBEBUILDER_ASSETS="$(bin/setup-envtest use 1.34.0 -p path --bin-dir bin)" go test ./pkg/... -timeout 30m | ||
| ``` | ||
|
|
||
| #### Running tests when Docker is unavailable or credential helper fails | ||
|
|
||
| When Docker works, use `make test`. If it fails (e.g. WSL: `docker-credential-desktop.exe` not in PATH): | ||
|
|
||
| - **Fix Docker (WSL):** Backup and clear config, then `make test`. Restore for private registry: `cp ~/.docker/config.json.bak ~/.docker/config.json`. | ||
| ```bash | ||
| cp ~/.docker/config.json ~/.docker/config.json.bak | ||
| echo '{}' > ~/.docker/config.json | ||
| ``` | ||
| See [Docker Desktop WSL](https://docs.docker.com/desktop/wsl/). | ||
|
|
||
| - **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 | ||
| ``` | ||
|
Comment on lines
+54
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarify "exit 1" expectation and consider version variable. Two points:
🤖 Prompt for AI Agents |
||
| Full validation: `make validate`, `make lint`, unit tests, then envtest. Helm: `helm unittest` or CI. | ||
|
|
||
| #### E2E tests | ||
|
|
||
| E2E tests run against a real Kubernetes using [`kind`](https://kind.sigs.k8s.io/) cluster and are located in `test/e2e/suites/`. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,4 +31,41 @@ To build and deploy KAI Scheduler from source, follow these steps: | |
| 5. Install on your cluster: | ||
| ```sh | ||
| helm upgrade -i kai-scheduler -n kai-scheduler --create-namespace ./charts/kai-scheduler-0.0.0.tgz | ||
| ``` | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| From the repository root, run `make test` (Helm chart + Go tests in Docker). | ||
|
|
||
| ### When `make test` fails (e.g. WSL: `docker-credential-desktop.exe` not in PATH) | ||
|
|
||
| **Option 1 — Fix Docker config (WSL):** | ||
|
|
||
| ```sh | ||
| cp ~/.docker/config.json ~/.docker/config.json.bak | ||
| echo '{}' > ~/.docker/config.json | ||
| make test | ||
| ``` | ||
|
|
||
| Restore for private registry: `cp ~/.docker/config.json.bak ~/.docker/config.json`. Docker Desktop may restore `credsStore` on restart. See [Docker Desktop WSL](https://docs.docker.com/desktop/wsl/). | ||
|
|
||
| **Option 2 — Run without Docker:** | ||
|
|
||
| - 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 | ||
|
Comment on lines
+54
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarify unit test expectations and version hardcoding. Two minor points:
🤖 Prompt for AI Agents |
||
| ``` | ||
| - Validation: `make validate`, `make lint`. | ||
|
|
||
| ### Version reference | ||
|
|
||
| | What | Defined in | Example | | ||
| |------|------------|---------| | ||
| | envtest K8s | `build/makefile/testenv.mk` → `ENVTEST_K8S_VERSION` | 1.34.0 | | ||
| | envtest tool | `build/makefile/testenv.mk` → `ENVTEST_VERSION` | release-0.20 | | ||
| | Go / builder | `build/makefile/golang.mk`, `build/builder/Dockerfile` | 1.24.4-bullseye | | ||
|
|
||
| Use Makefile/Dockerfile values; do not use `latest`. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Risk: Docker config overwrite may lose other settings beyond credsStore.
The command
echo '{}' > ~/.docker/config.jsonreplaces the entire Docker configuration file, not just thecredsStorefield. Users may have other important settings in this file (e.g.,authsfor registry credentials,proxies,experimentalflags,detachKeys, etc.) that will be lost.🛡️ Safer alternative using jq
This preserves other Docker settings while removing only the problematic
credsStorefield. Alternatively, document that users should manually edit the file to remove just thecredsStoreline, or verify they have no other important settings before using the destructive approach.📝 Committable suggestion
🤖 Prompt for AI Agents