Skip to content

Re-enable coverage upload and close remaining coverage gaps - #161

Merged
cep21 merged 3 commits into
masterfrom
cep21/coverage
Aug 18, 2026
Merged

Re-enable coverage upload and close remaining coverage gaps#161
cep21 merged 3 commits into
masterfrom
cep21/coverage

Conversation

@cep21

@cep21 cep21 commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

Coverage has not been published to Coveralls since January 2024 because the upload step was gated on refs/heads/main while the default branch is master; this points it at master. It also adds tests for the remaining uncovered paths so the number that gets published is meaningful: total statement coverage goes from 86.4% to ~97%, with the root package, closers/hystrix, metrics/rolling and metrics/responsetimeslo at 100%.

The biggest single gap was the example binary, which since Go 1.22 counts as 0% and dragged the module total down ~9 points. main() is split into newHandler/printInstructions (plus an -addr flag) so a smoke test can run the example circuits against an httptest server and check /debug/vars and /hystrix.stream; its background goroutines still panic if a circuit misbehaves, so it doubles as an integration check.

The remaining tests cover real behavior rather than just lines: CustomConfig merging, expvar output with rolling run/fallback stats (including a throttled fallback), Configurable logic receiving config updates, Prevent short-circuiting, ForcedClosed never opening, SLO factory per-circuit config/collectors, hystrix property reporting on the event stream, and a handful of nil-receiver / error-path cases.

No library source changes outside example/; public API untouched.

Test plan

make ci (build, go test -race -count 10 ./..., golangci-lint) passes locally. Built and ran example -addr 127.0.0.1:8124 -interval 20ms: /hystrix.stream returns 200 text/event-stream with data events, /debug/vars lists all nine circuits, process stays up. Coveralls upload itself can only be confirmed after merge to master.

cep21 added 3 commits August 18, 2026 11:00
The Coveralls upload step was gated on refs/heads/main, but the default
branch is master, so coverage has not been published since January 2024.
Point it at master.

Since Go 1.22 the untested example binary counted as 0% and pulled the
module total from ~95% to ~86%. main() is split into newHandler /
printInstructions (plus a new -addr flag) so a smoke test can run the
example circuits against an httptest server and check both /debug/vars
and /hystrix.stream. The background goroutines still panic if a circuit
misbehaves, so this doubles as an integration check.

New unit tests for previously uncovered paths:
- GeneralConfig CustomConfig merging (copy, no aliasing, receiver wins)
- Circuit/Manager Var output with rolling run + fallback stats, including
  a throttled fallback
- Configurable open/close logic receiving SetConfig{,Not}ThreadSafe
- ClosedToOpen.Prevent short-circuiting without opening
- ForcedClosed never transitioning to open, then opening once cleared
- nil Circuit/Manager receivers; SimpleBadRequest Cause/Unwrap
- rolling FallbackStats.Var and negative config sanitizing
- responsetimeslo Factory with per-circuit config and collectors
- hystrix Opener err_% in MarshalJSON
- metriceventstream hystrix property reporting and non-flushable writer
- faststats RollingSum and Atomic UnmarshalJSON error paths
- evar fallback for a Var whose String() is not JSON

Total statement coverage goes from 86.4% to ~97%; the root package,
closers/hystrix, metrics/rolling and metrics/responsetimeslo are at 100%.
No library (non-example) source changes.
Newer golangci-lint counts literals in _test.go files toward goconst's
per-package total, so the new tests tripped it for the expvar key names
already used twice in rolling.go and for a repeated value in
config_test.go. Decode into a struct instead of a keyed map and use
distinct values.

No-Verification-Needed: test-only change
golangci-lint-action installed whatever the latest linter was, so a new
goconst behavior broke this branch's CI while local runs on the previous
release were clean. Pin the version through GOLANGCI_LINT_VERSION with a
renovate marker and enable the customManagers:githubActionsVersions
preset so upgrades (and any new findings) show up in their own PR.

No-Verification-Needed: CI configuration and README only
@cep21
cep21 merged commit 0762890 into master Aug 18, 2026
6 checks passed
@cep21
cep21 deleted the cep21/coverage branch August 18, 2026 12:06
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