Skip to content

test(image): cover docker tag validation - #976

Merged
skevetter merged 2 commits into
mainfrom
pkg-container/image-tag-validation-tests
Aug 10, 2026
Merged

skevetter merged 2 commits into
mainfrom
pkg-container/image-tag-validation-tests

Conversation

@devsy-app

@devsy-app devsy-app Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Package reviewed

pkg/image — image reference parsing and validation used by the devsy build / devsy push commands.

Issue found

pkg/image had no test coverage for IsValidDockerTag and ValidateTags, despite these functions guarding user-supplied tags before they reach the registry. Tag validation is security- and correctness-relevant (an invalid tag can fail a push deep in the Docker client with an opaque error), so the lack of tests made regressions easy to miss.

Change

Added table-driven tests in pkg/image/image_test.go:

  • TestIsValidDockerTag — valid tags (semver, numeric, underscore, latest, max-size 128 chars) and invalid tags (leading dot, leading hyphen, embedded slash, embedded colon, embedded space, non-ascii, over-max).
  • TestValidateTags — nil slice returns no error, a valid slice returns no error, and the first-invalid-tag is reported with the offending value in the message.

No behavioral change to production code. A latestTag = "latest" constant was extracted in the test file to satisfy goconst (the value recurred across table cases).

Verification

  • task cli:format — clean.
  • task cli:lint:ci — 0 new issues.
  • go test ./pkg/image/... — PASS.
  • Full suite: only the known pre-existing failure pkg/git (TestRepoCloneFromInfoHelper, stale git-lfs filter assertion on origin/main) fails — unrelated to this change.

This PR was created by an AI agent as part of an automated daily package review job.

Add table-driven tests for IsValidDockerTag and ValidateTags in pkg/image.
@netlify

netlify Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 6fc7814
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a79409630149e000880d9a4

@netlify

netlify Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 6fc7814
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a794096f18bc500080bdc8f

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 15 complexity · 0 duplication

Metric Results
Complexity 15
Duplication 0

View in Codacy

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.

Run reviewer

TIP This summary will be updated as you push new changes.

Signed-off-by: Samuel K <skevetter@pm.me>
@skevetter
skevetter marked this pull request as ready for review August 10, 2026 03:08
@skevetter
skevetter enabled auto-merge (squash) August 10, 2026 03:08
@skevetter
skevetter merged commit c6aedb9 into main Aug 10, 2026
67 checks passed
@skevetter
skevetter deleted the pkg-container/image-tag-validation-tests branch August 10, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant