tests: raise eventstream coverage from 65% to 75%#1
Merged
Conversation
Cover the remaining broker branches by driving handleConn through net.Pipe-backed coreapi.Stream / net.Conn pairs: - Server.handleConn full subscribe/publish/cleanup path - Server.publish wildcard sender-skipped + topic '*' no-double-deliver - broker.handleConn subscribe-read-fail early return - broker.handleConn pubsub.subscribed / .unsubscribed / .published / .rate_limited bus event branches via a recording stub EventBus - broker.publishWith wildcard fan-out + wildcard topic skip + bus pubsub.published branch - Service.Stop ctx.Done() branch - takeToken refill cap at publishBurstBudget Package coverage 77.1% -> 89.2%; module total 65.2% -> 75.4%.
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
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.
Summary
Adds focused tests for previously uncovered broker and server branches. No production code changes — single new file
zz_added_coverage_test.go.Coverage delta:
eventstream: 77.1% -> 89.2%Per-function highlights:
server.handleConn0% -> 100%service.Stop88.9% -> 100%broker.handleConn72.4% -> 100%publishWith89.7% -> 100%takeToken94.7% -> 100%What the tests cover
Server.handleConnfull subscribe/publish/cleanup withnet.PipeconnectionsServer.publishwildcard sender-skipped + topic literal*no-double-deliver branchesbroker.handleConnsubscribe-read-fail early-return pathpubsub.subscribed,pubsub.unsubscribed,pubsub.published,pubsub.rate_limited) via a recording stubEventBusbroker.publishWithwildcard fan-out, sender-skip on wildcard, and topic-is-wildcard skip branchService.Stopctx.Done()early-return when shutdown blockstakeTokenrefill clamp atpublishBurstBudgetApproach: a
pipeStreamadapter wiresnet.Pipeintocoreapi.Stream, lettingbroker.handleConnrun end-to-end without a real driver/tunnel. Same trick (rawnet.Pipe) drivesServer.handleConnsince it takesnet.Conndirectly.Test plan
go test -race -count=1 -timeout 120s ./...passesgo vet ./...cleango tool cover -funcconfirms 75.4% module / 89.2% package