test: cover dockerinstall packages - #1074
Merged
Merged
Conversation
Add packages_test.go covering the previously-untested BuildPackageList and versionGte in pkg/dockerinstall. Pure test-only addition: verifies version-gated package selection (cli/containerd 18.09+, compose 20.10+, buildx 23.0+), extra-package appending, the empty-version fallback, and pre-release suffix comparison. No behavioral change.
✅ Deploy Preview for devsydev canceled.
|
✅ Deploy Preview for images-devsy-sh canceled.
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 10 |
| Duplication | 0 |
AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
Signed-off-by: Samuel K <skevetter@pm.me>
Signed-off-by: Samuel K <skevetter@pm.me>
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.
Package reviewed
pkg/dockerinstall— Docker installation helper (detector, validator, installer, packages).Issue found
packages.goexposes two pure, version-gated functions with zero test coverage:BuildPackageList(version, pkgVersion, cliPkgVersion, extraPkgs...)— builds the apt package list, conditionally includingdocker-ce-cli/containerd.io(18.09+),docker-compose-plugin(20.10+), anddocker-buildx-plugin(23.0+).versionGte(version, target)— numeric comparison that powers those gates, including pre-release suffix handling (-ce,-0~debian) and the empty-version fallback.detector.goandvalidator.goare well covered by existing suites, butpackages.gohad no tests at all, leaving the package-selection logic — the part that decides which Docker components get installed per version — unverified.Change
Added
pkg/dockerinstall/packages_test.go(new file) with aPackagesTestSuite(testify, matching the package's existing test style) covering:BuildPackageList: pre-18.09 (CLI/containerd absent), 18.09 with and without a pinned CLI version, compose added at 20.10, buildx added at 23.0, empty version enabling all features, and extra packages appended.versionGte: empty version, equal, greater/lesser major, greater/lesser minor, fewer parts ("23"vs"23.0"), pre-release suffixes ("20.10-ce","18.09-0~debian"), and a non-numeric component.No behavioral change — test-only addition. All cases document the existing intended behavior.
Verification
task cli:format— clean.task cli:lint:ci— 0 issues (new-from-patch against origin/main).task cli:test—pkg/dockerinstallpasses. The only failing package ispkg/git(TestRepoClone*), a known pre-existing stale assertion onorigin/mainunrelated to this change (this change does not touchpkg/git).go test ./pkg/dockerinstall/—ok(0.057s).Scope
One package (
pkg/dockerinstall), one new test file, no source changes.This PR was created by an AI agent as part of an automated daily package review job.