Skip to content

Add tests for ValidateBasic methods#2754

Merged
melekes merged 1 commit intotendermint:developfrom
katakonst:validate_basic_tests
Nov 9, 2018
Merged

Add tests for ValidateBasic methods#2754
melekes merged 1 commit intotendermint:developfrom
katakonst:validate_basic_tests

Conversation

@katakonst
Copy link
Contributor

Fixes #2740

  • Wrote tests

Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍓 🍍 🥛

Great work @katakonst! Thank you for contributing to Tendermint! We should probably rewrite TestEvidenceListMessageValidationBasic to not initialize reactors and there's also one small typo.

}
for _, tc := range testCases {
t.Run(tc.testName, func(t *testing.T) {
evList := sendEvidence(t, reactors[0].evpool, valAddr, NUM_EVIDENCE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to send it? can't we just validate it without running reactors and all that stuff?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to run the reactors.
Deleted that part.

{"Missing signature", func(hb *Heartbeat) {
hb.Signature = nil
}, true},
{"Signature to big", func(hb *Heartbeat) {
Copy link
Contributor

@melekes melekes Nov 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to -> is too

Suggested change
{"Signature to big", func(hb *Heartbeat) {
{"Signature is too big", func(hb *Heartbeat) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

@katakonst katakonst force-pushed the validate_basic_tests branch 2 times, most recently from b726a50 to 145f79d Compare November 5, 2018 17:48
@codecov-io
Copy link

codecov-io commented Nov 5, 2018

Codecov Report

Merging #2754 into develop will decrease coverage by 0.08%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           develop    #2754      +/-   ##
===========================================
- Coverage    62.37%   62.28%   -0.09%     
===========================================
  Files          212      212              
  Lines        17210    17193      -17     
===========================================
- Hits         10734    10708      -26     
- Misses        5578     5587       +9     
  Partials       898      898
Impacted Files Coverage Δ
consensus/reactor.go 65.85% <0%> (-2.45%) ⬇️
evidence/reactor.go 65% <0%> (+2%) ⬆️
p2p/test_util.go 70.43% <0%> (+3.76%) ⬆️

Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

n := 3
valAddr := []byte("myval")
evListMsg.Evidence = make([]types.Evidence, n)
for i := 0; i < 3; i++ {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 -> n

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed!

@katakonst katakonst force-pushed the validate_basic_tests branch from 145f79d to 95badb0 Compare November 8, 2018 07:55
@melekes melekes merged commit 46d32af into tendermint:develop Nov 9, 2018
maxim-levy pushed a commit to maxim-levy/tendermint that referenced this pull request Nov 13, 2018
* 'master' of https://github.com/tendermint/tendermint: (330 commits)
  Release/v0.26.1 (tendermint#2803)
  fix amino overhead computation for Tx (tendermint#2792)
  p2p: re-check after sleeps (tendermint#2664)
  check the result of `ps.peer.Send` before calling `ps.setHasVote` (tendermint#2787)
  p2p: AddressBook requires addresses to have IDs; Do not close conn immediately after sending pex addrs in seed mode (tendermint#2797)
  test AutoFile#Size (happy path)
  [autofile/group] do not panic when checking size
  openFile creates a file if not exist => ErrNotExist is not possible
  use our logger in autofile/group
  Add tests for ValidateBasic methods (tendermint#2754)
  [docs] improve organization of ABCI docs & fix links (tendermint#2749)
  p2p: peer-id -> peer_id (tendermint#2771)
  mempool: print postCheck error (tendermint#2762)
  Fix crypto/merkle ProofOperators.Verify to check bounds on keypath pa… (tendermint#2756)
  Mempool WAL is still created by default in home directory, leads to permission errors (tendermint#2758)
  mempool: ErrPreCheck and more log info (tendermint#2724)
  Release/v0.26.0 (tendermint#2726)
  [ADR] [DRAFT] pubsub 2.0 (tendermint#2532)
  validate reactor messages (tendermint#2711)
  TMHASH is 32 bytes. Closes tendermint#1990 (tendermint#2732)
  ...
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.

3 participants