-
Notifications
You must be signed in to change notification settings - Fork 129
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
testing (dot/core): rewrite message.go unit tests #2197
testing (dot/core): rewrite message.go unit tests #2197
Conversation
Codecov Report
@@ Coverage Diff @@
## jimmy/coreIntegrationTests #2197 +/- ##
=============================================================
Coverage ? 59.73%
=============================================================
Files ? 210
Lines ? 27371
Branches ? 0
=============================================================
Hits ? 16349
Misses ? 9320
Partials ? 1702
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
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.
That test.log
though 😄
Looks good, just a few comments here and there
txs := make([]*transaction.ValidTransaction, 2) | ||
|
||
mockTxnStateEmpty.EXPECT().PendingInPool().Return([]*transaction.ValidTransaction{}) | ||
mockTxnState.EXPECT().PendingInPool().Return(txs) |
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.
wait why is the transaction state returning a slice with nil transactions?
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.
Cuz I'm only testing the length function, so i thought it would be good to have a test case testing empty input. Can remove that case if that's preferred
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 you pull development into here? that should remove the test.log file completely
4b18eab
to
55fd785
Compare
…lue (#2143) * fix: return error if result already has an assigned value * chore: include unit test * chore: fix typo `ErrResultAlreadySet` * chore: remove unneeded `require.Error` * chore: fix undeclared name * chore: remove packaged scope var to avoid problems with result type * chore: fix result.Set error at offchain test
e70b2ee
to
ec7b7ff
Compare
dot/core/messages.go
Outdated
@@ -41,56 +78,29 @@ func (s *Service) HandleTransactionMessage(peerID peer.ID, msg *network.Transact | |||
return false, err | |||
} | |||
|
|||
isValid := true |
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.
nit perhaps rename to allTxsAreValid
? 🤔
Value: peerset.BadTransactionValue, | ||
Reason: peerset.BadTransactionReason, | ||
}, | ||
id: peer.ID("jimbo"), |
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.
Leaving the author's mark 😄
…ssage.go` unit tests (#2224) * chore(pkg/scale): return error if `Result` already has an assigned value (#2143) * fix: return error if result already has an assigned value * chore: include unit test * chore: fix typo `ErrResultAlreadySet` * chore: remove unneeded `require.Error` * chore: fix undeclared name * chore: remove packaged scope var to avoid problems with result type * chore: fix result.Set error at offchain test * migrate core tests to integration tests * remove test.log * upgrade integration tests to match dev * testing (dot/core): rewrite message.go unit tests (#2197) * chore(pkg/scale): return error if `Result` already has an assigned value (#2143) * fix: return error if result already has an assigned value * chore: include unit test * chore: fix typo `ErrResultAlreadySet` * chore: remove unneeded `require.Error` * chore: fix undeclared name * chore: remove packaged scope var to avoid problems with result type * chore: fix result.Set error at offchain test * test txt count and generate mocks with mockgen * WIP/hanldeTxnMsgTest * WIP/core message tests * wip/finish core message tests * wip/message test * fix reporting issue * test core messages * remove comments and lint * remove unused file * wip/cr feedback * use dummy error for tests * wip/finish cr feedback * wip/move message validation to a separate function * move txn validity check to new func * lint * fix variable naming to make less confusing * remove pointer from validateTxn helper params * refactor tests to define mocks in subtest * CR feedback * finish feedback for core tests * define runtime mocks in subtest * remane validTxn var Co-authored-by: Eclésio Junior <[email protected]> * CR feedback * finish feedback * CR feedback Co-authored-by: Eclésio Junior <[email protected]>
Changes
Tests
Issues
Primary Reviewer