Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpcserver: add handleTicketFeeInfo tests. #2408

Merged
merged 1 commit into from
Oct 27, 2020

Conversation

dnldd
Copy link
Member

@dnldd dnldd commented Oct 8, 2020

depends on #2407

This adds rpc tests for handleTicketFeeInfo.

Work towards #2069.

@dnldd
Copy link
Member Author

dnldd commented Oct 8, 2020

go tool cover -func=cov.out | grep -E handleTicketFeeInfo
github.com/decred/dcrd/internal/rpcserver/rpcserver.go:4881:              handleTicketFeeInfo             97.2%

Having some difficulty hitting this, pointers appreciated.

@rstaudt2
Copy link
Member

rstaudt2 commented Oct 9, 2020

go tool cover -func=cov.out | grep -E handleTicketFeeInfo
github.com/decred/dcrd/internal/rpcserver/rpcserver.go:4881:              handleTicketFeeInfo             97.2%

Having some difficulty hitting this, pointers appreciated.

You can stub any of the functions called in ticketFeeInfoForRange to return an err to hit that case. For example:

mockChain: func() *testRPCChain {
	chain := defaultMockRPCChain()
	chain.heightRangeErr = errors.New("")
	return chain
}(),

It's probably worth getting test coverage on the ticketFeeInfoForRange function as well.

@dnldd dnldd force-pushed the add_ticket_fee_info_tests branch 2 times, most recently from cab7cca to 296a015 Compare October 9, 2020 14:20
@dnldd
Copy link
Member Author

dnldd commented Oct 9, 2020

Needed to make the heightRange field a function to facilitate mocking it to fail on the second call.

go tool cover -func=cov.out | grep -E handleTicketFeeInfo
github.com/decred/dcrd/internal/rpcserver/rpcserver.go:4881:            handleTicketFeeInfo           100.0%

@davecgh davecgh added the test coverage Discussion and pull requests for improving test coverage. label Oct 14, 2020
@davecgh davecgh added this to the 1.7.0 milestone Oct 16, 2020
This adds rpc tests for handleTicketFeeInfo.
@davecgh
Copy link
Member

davecgh commented Oct 26, 2020

This looks ready to me.

@rstaudt2 Is all of your feedback addressed?

@davecgh davecgh merged commit 110ae1e into decred:master Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test coverage Discussion and pull requests for improving test coverage.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants