Skip to content

test: cover pure helpers, static GetHost and boxes client actions - #1219

Merged
cdalar merged 1 commit into
mainfrom
test-coverage-helpers
Oct 22, 2026
Merged

cdalar merged 1 commit into
mainfrom
test-coverage-helpers

Conversation

@cdalar

@cdalar cdalar commented Oct 22, 2026

Copy link
Copy Markdown
Owner

What

Unit tests for logic that needed no credentials, terminal or hypervisor and had no coverage. No production code changes.

Package Before After
cmd 46.2% 47.9%
pkg/cloud 51.5% 51.8%
internal/providerboxes 64.6% 74.6%
  • cmd/helpers_test.go (new): ago/shortAgo time buckets; stateStyle mapping every provider's stopped spelling to paused-yellow; attachHint naming the provider unless on boxes; per-task WIP refs; claudeTokenPath; localClaudeTheme tolerating a missing or malformed ~/.claude.json; checkCloudProvider auto-detecting from credentials and exporting ONCTL_CLOUD; remoteForVM for static hosts (inventory user/port/key win over defaults, an explicit port flag wins over inventory, unknown host is an error).
  • pkg/cloud/static_test.go: GetHost returns the imported host verbatim and errors for an unknown name.
  • internal/providerboxes/client_test.go: Pause/Resume/Destroy/SetIdleTTL/ListImages/ListSizes hit the right method and route with the box name escaped; SetIdleTTL sends seconds.

Each test's comment states why the behaviour matters, so it fails if the intent changes, not just the implementation.

Skipped on purpose

The remaining zero-coverage code is cloud SDK client constructors, interactive prompts, ssh/tmux sessions and VMM process managers, which need credentials, a terminal or a hypervisor.

🤖 Generated with Claude Code

Unit tests for logic that needed no credentials, terminal or hypervisor
and had none: ago/shortAgo buckets, stateStyle's paused mapping across
provider spellings, attachHint naming the provider, per-task WIP refs,
the Claude token path, localClaudeTheme tolerating a bad ~/.claude.json,
checkCloudProvider's credential auto-detect, remoteForVM for imported
hosts, ProviderStatic.GetHost, and the boxes client's Pause/Resume/
Destroy/SetIdleTTL/ListImages/ListSizes routes.

cmd 46.2% -> 47.9%, pkg/cloud 51.5% -> 51.8%, providerboxes 64.6% -> 74.6%.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.72%. Comparing base (121040e) to head (a014e75).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1219      +/-   ##
==========================================
+ Coverage   45.70%   46.72%   +1.02%     
==========================================
  Files          75       75              
  Lines        8783     8783              
==========================================
+ Hits         4014     4104      +90     
+ Misses       4769     4679      -90     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cdalar
cdalar merged commit 8de477b into main Oct 22, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ 换网址