Skip to content

Conversation

@ncode
Copy link
Owner

@ncode ncode commented Dec 25, 2025

Summary

Add comprehensive tests for previously uncovered code paths:

Wrapper tests:

  • consulClient wrapper methods (Agent, Catalog, Health, Session, KV)
  • commandExecutor.CommandContext

Async execution tests:

  • updateServiceTags command execution (ExecOnPromote/ExecOnDemote)
  • Error handling in command execution goroutine
  • Session data retrieval failures

Edge case tests:

  • Run with small TTL (< 2s interval branch)
  • Run election error handling in ticker loop
  • updateLeadershipStatus error return path
  • New viper unmarshal error
  • New default values for LockDelay/TTL/Name

Coverage

Local measurements:

  • New: 85.7% → 96.4%
  • Run: 69.2% → 76.9%
  • updateLeadershipStatus: 80% → 100%
  • consulClient wrappers: 0% → 100%
  • commandExecutor.CommandContext: 0% → 100%

Note: HealthWrapper.Checks remains at 0% - it wraps *api.Health (concrete type) and requires a real Consul instance (covered by integration tests).

Test plan

  • All existing tests pass
  • New tests pass
  • All modified and coverable lines are covered

🤖 Generated with Claude Code

Add tests for previously uncovered code paths:

- consulClient wrapper methods (Agent, Catalog, Health, Session, KV)
- commandExecutor.CommandContext
- updateServiceTags async command execution (ExecOnPromote/ExecOnDemote)
- Error handling in command execution goroutine

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Dec 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.56%. Comparing base (cadac98) to head (29afeb6).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #28      +/-   ##
==========================================
+ Coverage   78.25%   86.56%   +8.31%     
==========================================
  Files           4        4              
  Lines         469      469              
==========================================
+ Hits          367      406      +39     
+ Misses         82       45      -37     
+ Partials       20       18       -2     

☔ View full report in Codecov by Sentry.
📢 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.

@ncode ncode changed the title test: improve coverage from 84.9% to 90.5% test: improve coverage from 78.25% to 85.71% Dec 25, 2025
- TestRun_SmallTTL: covers TTL < 2s branch in Run()
- TestRun_ElectionErrorInLoop: covers error handling in ticker loop
- TestUpdateLeadershipStatus_Error: covers error return path
- TestNew_ViperUnmarshalError: covers viper unmarshal failure
- TestNew_DefaultValues: covers default LockDelay/TTL/Name paths

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ncode ncode changed the title test: improve coverage from 78.25% to 85.71% test: improve test coverage Dec 25, 2025
@ncode ncode merged commit 0886040 into main Dec 25, 2025
7 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