Repository navigation
test(agent): cover inject URL/option defaults - #955
Merged
Merged
Conversation
Add unit tests for InjectOptions URL and prefer-download default logic in pkg/agent/inject.go: applyURLDefaults tag->download normalization, applyPreferDownloadDefaults DEVSY_AGENT_URL/DEVSY_AGENT_PREFER_DOWNLOAD side effects, and explicit preference preservation. These DEVSY_AGENT_URL side-effect paths had no direct test coverage.
✅ Deploy Preview for devsydev canceled.
|
✅ Deploy Preview for images-devsy-sh canceled.
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 10 |
| Duplication | 2 |
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.
Break the TestApplyPreferDownloadDefaults subtests into top-level test functions to satisfy funlen, and replace Bool(true) with new(true) to satisfy the govet inline analyzer (matching production style in agent.go).
Signed-off-by: GitHub <noreply@github.com>
skevetter
marked this pull request as ready for review
August 9, 2026 17:30
skevetter
enabled auto-merge (squash)
August 9, 2026 17:30
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/agent(agent-runtime core category) — focused on theInjectOptionsdefault-resolution logic that backs theDEVSY_AGENT_URL/AGENT_URL/ GitHub-release precedence documented inpkg/options/resolve.go.Issue found
The
DEVSY_AGENT_URLside-effect paths inpkg/agent/inject.gohad no direct unit-test coverage:applyURLDefaults()— tag-style release URL →/download/normalization (e.g..../releases/tags/v1→.../releases/download/v1).applyPreferDownloadDefaults()— the two documentedDEVSY_AGENT_URLside effects:PreferDownloadFromRemoteUrl = trueandSkipVersionCheck = true.applyEnvPreference()—DEVSY_AGENT_PREFER_DOWNLOADparsing, including the edge case where an invalid bool string logs a warning and defaults totrue(fail-open toward remote download).These are exactly the resolution-order / config-default behaviors the reviewer is asked to protect, so a regression here would silently change agent binary download behavior. Tests pin them.
Change
New file
pkg/agent/inject_defaults_test.go(test-only, no behavioral change):TestApplyURLDefaults_NormalizesTagURL/PreservesNonTagURL/FillsFromEnvWhenEmptyTestApplyPreferDownloadDefaultssubtests:custom_agent_url_prefers_remote_and_skips_version_checkprefer_download_env_trueprefer_download_env_falseprefer_download_env_invalid_defaults_truedefault_dev_build_prefers_localexplicit_preference_preservedVerification
task cli:format— clean.task cli:lint:ci—0 issues(only-new-issues, mirrors CI).task cli:test—pkg/agent/...passes (ok); the only repo-wide failure is the known pre-existingpkg/gitTestRepoClone*stale-assertion failure onorigin/main, unrelated to this change (this PR touches onlypkg/agent).This PR was created by an AI agent as part of an automated daily package review job.