Add tests for cluster configuration, command execution, and ArgoCD in…#35
Merged
Conversation
…tegration - Introduced unit tests for RequestClusters unmarshalling from YAML and JSON formats. - Updated schema.json to simplify validation for volumes, envs, labels, and annotations. - Refactored command execution to capture stdout more efficiently. - Added tests for command execution, including capturing stdout and handling errors. - Enhanced ArgoCD deployment logic to use context for command execution and improved error handling. - Added tests for ArgoCD agent functionalities, including generating arguments and replacing cluster URLs. - Improved K3D cluster creation logic and added tests for argument parsing. - Added tests for random string generation utility.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR strengthens the repo’s reliability and release automation by adding new unit tests across several packages, improving command execution and ArgoCD integration behavior, updating the JSON schema, and modernizing CI/release workflows and Go module dependencies.
Changes:
- Added unit tests for random utilities, k3d argument parsing, ArgoCD helper functions, and cluster config unmarshalling.
- Refactored command stdout capture and updated ArgoCD command execution to use contexts more consistently.
- Updated schema generation and modernized project automation (Go module/deps updates, new CI workflow, GoReleaser workflows, Dependabot).
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/random/random_test.go | Adds tests validating random string length and allowed charset. |
| pkg/kubernetes/k3d/k3d.go | Improves path handling and cluster creation flow; simplifies arg pass-through. |
| pkg/kubernetes/k3d/k3d_test.go | Adds coverage for k3d cluster create argument generation. |
| pkg/gitops/argocd/argocd.go | Uses context-aware exec in more places; improves env restore handling; adjusts cluster add wiring. |
| pkg/gitops/argocd/argocd_test.go | Adds tests for arg generation, kubeconfig URL replacement, and bind address selection. |
| pkg/exec/exec.go | Refactors stdout capture to buffer-based approach. |
| pkg/exec/exec_test.go | Adds tests for command mapping and stdout/error behavior. |
| pkg/config/v1alpha1/schema.json | Simplifies object validation for volumes/envs/labels/annotations. |
| pkg/config/v1alpha1/cluster_config_test.go | Adds tests for YAML/JSON unmarshalling of cluster configs. |
| go.sum | Updates dependency checksums after module upgrades/tidy. |
| go.mod | Bumps Go version and updates direct/indirect dependencies. |
| cmd/clusters/clusters.go | Uses filepath-safe paths, safer cleanup, and ensures gitops ops run with timeout context. |
| .goreleaser.yaml | Updates config for GoReleaser v2 and snapshot templating. |
| .github/workflows/go_releaser_tags.yml | Modernizes tag release workflow (pinned actions, go-version-file, GoReleaser v2). |
| .github/workflows/go_releaser_branches.yml | Modernizes snapshot workflow for branches (pinned actions, go-version-file, GoReleaser v2). |
| .github/workflows/ci.yml | Adds CI for build/vet/test, tidy checks, and schema regeneration checks. |
| .github/dependabot.yml | Enables weekly dependency updates for Go modules and GitHub Actions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…tegration