Repository navigation
test: cover pkg/template fill helpers - #1010
Merged
Merged
Conversation
pkg/template had no tests despite powering agent inject script generation via FillTemplate. Add table-driven tests for FillTemplate (substitution, multiple/reused vars, no-vars passthrough, missing-var no-value sentinel, unclosed-action parse error, empty template) and WriteFiles (content + 0o600 perms, nested-path failure documents no-mkdir behavior, missing-folder error). Brings pkg/template coverage to 92.3% with 0 new lint issues.
✅ Deploy Preview for devsydev canceled.
|
✅ Deploy Preview for images-devsy-sh canceled.
|
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 1 critical |
🟢 Metrics 9 complexity · 0 duplication
Metric Results Complexity 9 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.
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/template— theFillTemplateandWriteFileshelpers that render the agent inject script from variable maps.Issue found
pkg/templatehad no tests despiteFillTemplatepowering agent inject script generation (pkg/agent/inject.gouses it to render the inject script from a variable map). The behavior of edge cases (missing variables, unclosed actions, empty templates,WriteFilespermissions) was undocumented.Change
Added
pkg/template/fill_test.gowith table-driven coverage:FillTemplate: simple substitution, multiple vars, repeated var reused, no-vars passthrough, missing-var `` sentinel, unclosed-action parse error, empty template.WriteFiles: flat file content +0o600permission assertions, nested-path failure (documents no-mkdir behavior), missing-folder error.Pure test additions — no behavioral changes. Brings
pkg/templatecoverage to 92.3%.Verification performed
task cli:format— clean (gofmt/gci/gofumpt/golines).task cli:lint:ci— 0 new issues (fullgolangci-lint run ./pkg/template/...also 0 issues: resolved goconst duplicate-string and gosec G304 via repo-convention// #nosec G304on temp paths).task cli:test—pkg/templatepasses. Only the documented pre-existingpkg/gitfailures (TestRepoCloneArgsThroughRunner,TestRepoCloneFromInfoBranch,TestRepoCloneFromInfoHelper) remain onorigin/main; this change does not touchpkg/git.This PR was created by an AI agent as part of an automated daily package review job.