-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
R4R: Increase BaseApp Test Coverage #3468
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3468 +/- ##
===========================================
+ Coverage 59.51% 59.97% +0.46%
===========================================
Files 135 135
Lines 9981 9960 -21
===========================================
+ Hits 5940 5974 +34
+ Misses 3669 3619 -50
+ Partials 372 367 -5 |
🔥🚀🌔 |
// Implements ABCI. | ||
// Delegates to CommitMultiStore if it implements Queryable | ||
// Query implements the ABCI interface. It delegates to CommitMultiStore if it | ||
// implements Queryable. | ||
func (app *BaseApp) Query(req abci.RequestQuery) (res abci.ResponseQuery) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be really nice to have the ABCI query functionality documented in detail for each module and query. cc @mossid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These testcases look fine; thanks for cleaning up all the comments - can we also add some for:
LoadVersion
usage- Bad query paths on the query router
- Quick message router tests (add
router_test.go
)
And can we cleanup:
baseapp/helpers.go
-RunForever
is not used, probably the other functions aren't either- Delete
baseapp/query.go
- unused, very out of date - Remove the entire
testdata
folder - unused, very out of date
baseapp/baseapp.go
Outdated
// Router returns the router of the BaseApp. | ||
func (app *BaseApp) Router() Router { | ||
if app.sealed { | ||
// TODO: Why are panicing here on returning the router??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Becase AddRoute
can be called, I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this right? can we update the comment?
@@ -117,7 +120,8 @@ func (app *BaseApp) SetCommitMultiStoreTracer(w io.Writer) { | |||
app.cms.WithTracer(w) | |||
} | |||
|
|||
// Mount IAVL or DB stores to the provided keys in the BaseApp multistore | |||
// MountStores mounts all IAVL or DB stores to the provided keys in the BaseApp | |||
// multistore. | |||
func (app *BaseApp) MountStores(keys ...*sdk.KVStoreKey) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this MountStores function take both transient keys and store keys? It could look like:
func (app *BaseApp) MountStores(keys ...interface{}) {
for _, key := range keys {
switch key.(type) {
case *sdk.KVStoreKey:
if !app.fauxMerkleMode {
app.MountStore(key, sdk.StoreTypeIAVL)
} else {
app.MountStore(key, sdk.StoreTypeDB)
}
case *sdk.TransientStoreKey:
app.MountStore(key, sdk.StoreTypeTransient
}
default:
panic("Invalid key type")
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good idea - but perhaps best for a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I think this falls under general app.go
cleanup
@cwgoes I've address your comments. In addition, I also cleaned up the existing router a bit (now using a map instead of a slice). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few further notes on comments; otherwise LGTM.
baseapp/baseapp.go
Outdated
// Router returns the router of the BaseApp. | ||
func (app *BaseApp) Router() Router { | ||
if app.sealed { | ||
// TODO: Why are panicing here on returning the router??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this right? can we update the comment?
@cwgoes addressed |
Adds a test case for #3259 and a few other small test cases to increase coverage. In addition, minor cleanup to godocs and general structure (no functional changes). This PR is pending further additional test cases we deem necessary.
closes: #556
closes: #3259
Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added entries in
PENDING.md
with issue #rereviewed
Files changed
in the github PR explorerFor Admin Use: