Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: configure ENVTEST binaries for IDE execution and project-specifi…
…c setup - Installs ENVTEST binaries in the project’s `./bin/envtest` directory for isolation. - Configures `setup-envtest` binary to be downloaded based on the controller-runtime release version to ensure compatibility with the project’s dependencies. - Updates `suite_test.go` to dynamically locate and set the binary assets directory for seamless IDE debugging. - Introduces `getFirstFoundEnvTestBinaryDir` to detect ENVTEST binaries in the project directory when running tests outside the Makefile context. 1. **Ease of IDE Debugging**: - By setting the `BinaryAssetsDirectory` dynamically, contributors can debug tests in their preferred IDEs (e.g., GoLand, VSCode) without requiring additional environment configuration such as setting `KUBEBUILDER_ASSETS`. 2. **Project-Specific Binaries**: - Installing binaries inside the project avoids conflicts with other projects or system-wide installations, particularly useful for contributors with restricted environments (e.g., corporate laptops). 3. **Consistency**: - Using `setup-envtest` from the matching controller-runtime release avoids compatibility issues, such as those outlined in [#2744](kubernetes-sigs/controller-runtime#2744) and [#2646](kubernetes-sigs/controller-runtime#2646). 4. **Simplified Contributor Onboarding**: - New contributors often face a learning curve to: - Understand ENVTEST and its dependency on binaries. - Configure `KUBEBUILDER_ASSETS` manually. - Set up their IDE for debugging tests. - This setup minimizes friction and ensures tests can be run consistently across different environments. While setting `KUBEBUILDER_ASSETS` is sufficient for experienced contributors, this change makes it easier for newcomers and supports debugging directly in IDEs without additional configuration.
- Loading branch information