Repository navigation
test: cover credential helper script gen - #981
Merged
Merged
Conversation
Add tests for pkg/dockercredentials buildHelperContent covering unix and windows credential-helper script generation: shebang/echo prefix, embedded port, the literal 'internal agent docker-credentials' subcommand, LF vs CRLF line endings, single-quote quoting of binary paths with spaces, and windows percent-doubling. Also covers newDockerCredentialsDir naming/length and appendToPath PATH extension. These functions had zero test coverage; no behavioral change.
✅ Deploy Preview for devsydev canceled.
|
✅ Deploy Preview for images-devsy-sh canceled.
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 16 |
| 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>
skevetter
marked this pull request as ready for review
August 11, 2026 05:23
skevetter
enabled auto-merge (squash)
August 11, 2026 05:23
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/dockercredentials— Docker credential helper configuration (scope: container/Docker category).Issue found
buildHelperContent(and the related unexported helpersnewDockerCredentialsDirandappendToPath) had zero test coverage.buildHelperContentgenerates the executable credential-helper script that Docker invokes to fetch registry credentials, and it branches onruntime.GOOSto produce a Unix (#!/bin/sh) or Windows (@echo off) script, quoting a caller-supplied binary path. Because it writes an executable invoked by Docker with credential forwarding, silent regressions in its format (wrong subcommand, missing quoting, wrong line endings, dropped port) would be hard to catch without tests.Change
Add
pkg/dockercredentials/helper_content_test.go(test-only, no behavioral change) covering:internal agent docker-credentialssubcommand,--port <N>,"$@"passthrough, trailing newline, LF line endings (no CR).@echo offprefix, double-quoted binary path, the same subcommand/--port/%*passthrough, trailing CRLF.internal).%-doubling in the binary path (literal%becomes%%socmddoes not expand it).newDockerCredentialsDirnaming prefix and 12-char random suffix length.appendToPathappends the directory toPATHwith the platform separator.Platform-specific cases skip on the wrong OS so the suite is green on Linux CI (the unix cases run; the windows cases skip).
Verification performed
task cli:format— clean (no formatting changes).task cli:lint:ci—0 issues.task cli:test—pkg/dockercredentialspasses; the only failing package ispkg/git(TestRepoClone*), the documented pre-existing failure onorigin/main, unrelated to this change (this PR does not touchpkg/git).go test ./pkg/dockercredentials/ -run TestHelperContentSuite -v— all non-skipped cases PASS.This PR was created by an AI agent as part of an automated daily package review job.