Skip to content

test(provider): cover ParseOptions branches - #1057

Open
devsy-app[bot] wants to merge 8 commits into
mainfrom
pkg-core-agent/parse-options-tests
Open

test(provider): cover ParseOptions branches#1057
devsy-app[bot] wants to merge 8 commits into
mainfrom
pkg-core-agent/parse-options-tests

Conversation

@devsy-app

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

Copy link
Copy Markdown
Contributor

Package reviewed

pkg/provider — agent-runtime core category.

Issue found

ParseOptions in pkg/provider/parse.go had no test coverage, despite being a shared helper consumed by multiple client implementations (e.g. the Docker/Colima provider clients parse key=value option strings into typed option maps). The function performs several non-trivial transformations — key uppercasing, whitespace trimming, value-with-equals preservation, and rejection of malformed entries — none of which were exercised by tests, leaving regressions undetectable.

Change

Add a focused, table-driven test (pkg/provider/parse_options_test.go) that covers every branch of ParseOptions:

  • empty input → empty map, no error
  • single key=value
  • value containing = is preserved verbatim (port=8080=foo)
  • key is lowercased then uppercased (name=devsyNAME)
  • surrounding whitespace on both key and value is trimmed
  • multiple options are all collected into the map
  • an option without = is rejected with an error

No behavioral change — this is purely added test coverage for existing, exercised production code. The function's resolution semantics (it operates on raw option strings, independent of the DEVSY_AGENT_URL / AGENT_URL / GitHub-release resolution order in pkg/options/resolve.go) are unchanged.

Verification performed

  • task cli:format — clean, no formatting changes
  • task cli:lint:ci — 0 issues
  • task cli:test — passes; the only failures are the known pre-existing pkg/git tests (TestRepoCloneArgsThroughRunner, TestRepoCloneFromInfoBranch, TestRepoCloneFromInfoHelper), which fail on origin/main already and are unrelated to this change (this change does not touch pkg/git)
  • pkg/provider tests: ok github.com/devsy-org/devsy/pkg/provider — all new subcases pass

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

Add table-driven tests for ParseOptions in pkg/provider/parse.go, which previously had no test coverage despite being used by multiple client implementations. Covers empty input, value-with-equals preservation, key uppercasing and whitespace trimming, multiple-option collection, and rejection of options without an equals sign.
@netlify

netlify Bot commented Aug 15, 2026

Copy link
Copy Markdown

Deploy Preview for images-devsy-sh canceled.

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

@netlify

netlify Bot commented Aug 15, 2026

Copy link
Copy Markdown

👷 Deploy Preview for devsydev processing.

Name Link
🔨 Latest commit 14d8ae1
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a834aba3b19dc000893428c

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity · 0 duplication

Metric Results
Complexity 4
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.

@skevetter
skevetter marked this pull request as ready for review August 17, 2026 05:50
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