Browse Source

blockchain: Block creator helper for compressing tests as per @ebuchman

pull/677/head
Emmanuel Odeke 7 years ago
committed by Ethan Buchman
parent
commit
96998a5498
2 changed files with 16 additions and 257 deletions
  1. +0
    -225
      blockchain/outf.outf
  2. +16
    -32
      blockchain/store_test.go

+ 0
- 225
blockchain/outf.outf View File

@ -1,225 +0,0 @@
mode: set
github.com/tendermint/tendermint/blockchain/pool.go:51.99,64.2 3 1
github.com/tendermint/tendermint/blockchain/pool.go:66.40,70.2 3 1
github.com/tendermint/tendermint/blockchain/pool.go:72.33,74.2 1 1
github.com/tendermint/tendermint/blockchain/pool.go:77.48,78.6 1 1
github.com/tendermint/tendermint/blockchain/pool.go:78.6,79.24 1 1
github.com/tendermint/tendermint/blockchain/pool.go:82.3,83.39 2 1
github.com/tendermint/tendermint/blockchain/pool.go:79.24,80.9 1 1
github.com/tendermint/tendermint/blockchain/pool.go:83.39,88.4 2 1
github.com/tendermint/tendermint/blockchain/pool.go:88.4,88.49 1 1
github.com/tendermint/tendermint/blockchain/pool.go:88.49,93.4 2 1
github.com/tendermint/tendermint/blockchain/pool.go:93.4,96.4 1 1
github.com/tendermint/tendermint/blockchain/pool.go:100.46,104.34 3 1
github.com/tendermint/tendermint/blockchain/pool.go:104.34,105.46 1 1
github.com/tendermint/tendermint/blockchain/pool.go:114.3,114.22 1 1
github.com/tendermint/tendermint/blockchain/pool.go:105.46,108.45 2 1
github.com/tendermint/tendermint/blockchain/pool.go:108.45,112.5 3 0
github.com/tendermint/tendermint/blockchain/pool.go:114.22,116.4 1 0
github.com/tendermint/tendermint/blockchain/pool.go:120.86,125.2 3 1
github.com/tendermint/tendermint/blockchain/pool.go:128.42,133.26 3 0
github.com/tendermint/tendermint/blockchain/pool.go:138.2,139.34 2 0
github.com/tendermint/tendermint/blockchain/pool.go:144.2,148.19 5 0
github.com/tendermint/tendermint/blockchain/pool.go:133.26,136.3 2 0
github.com/tendermint/tendermint/blockchain/pool.go:139.34,141.3 1 0
github.com/tendermint/tendermint/blockchain/pool.go:154.82,158.49 3 1
github.com/tendermint/tendermint/blockchain/pool.go:161.2,161.51 1 1
github.com/tendermint/tendermint/blockchain/pool.go:164.2,164.8 1 1
github.com/tendermint/tendermint/blockchain/pool.go:158.49,160.3 1 1
github.com/tendermint/tendermint/blockchain/pool.go:161.51,163.3 1 1
github.com/tendermint/tendermint/blockchain/pool.go:169.37,173.49 3 0
github.com/tendermint/tendermint/blockchain/pool.go:173.49,182.3 3 0
github.com/tendermint/tendermint/blockchain/pool.go:182.3,184.3 1 0
github.com/tendermint/tendermint/blockchain/pool.go:189.48,194.26 4 0
github.com/tendermint/tendermint/blockchain/pool.go:199.2,199.33 1 0
github.com/tendermint/tendermint/blockchain/pool.go:194.26,196.3 1 0
github.com/tendermint/tendermint/blockchain/pool.go:203.83,208.22 4 1
github.com/tendermint/tendermint/blockchain/pool.go:212.2,212.39 1 1
github.com/tendermint/tendermint/blockchain/pool.go:208.22,210.3 1 0
github.com/tendermint/tendermint/blockchain/pool.go:212.39,216.3 3 1
github.com/tendermint/tendermint/blockchain/pool.go:216.3,218.3 0 0
github.com/tendermint/tendermint/blockchain/pool.go:222.65,227.17 4 1
github.com/tendermint/tendermint/blockchain/pool.go:227.17,229.3 1 0
github.com/tendermint/tendermint/blockchain/pool.go:229.3,233.3 3 1
github.com/tendermint/tendermint/blockchain/pool.go:236.50,241.2 3 0
github.com/tendermint/tendermint/blockchain/pool.go:243.50,244.44 1 0
github.com/tendermint/tendermint/blockchain/pool.go:252.2,252.28 1 0
github.com/tendermint/tendermint/blockchain/pool.go:244.44,245.38 1 0
github.com/tendermint/tendermint/blockchain/pool.go:245.38,246.35 1 0
github.com/tendermint/tendermint/blockchain/pool.go:249.4,249.23 1 0
github.com/tendermint/tendermint/blockchain/pool.go:246.35,248.5 1 0
github.com/tendermint/tendermint/blockchain/pool.go:257.69,261.34 3 1
github.com/tendermint/tendermint/blockchain/pool.go:275.2,275.12 1 1
github.com/tendermint/tendermint/blockchain/pool.go:261.34,262.22 1 1
github.com/tendermint/tendermint/blockchain/pool.go:266.3,266.51 1 1
github.com/tendermint/tendermint/blockchain/pool.go:269.3,269.30 1 1
github.com/tendermint/tendermint/blockchain/pool.go:272.3,273.14 2 1
github.com/tendermint/tendermint/blockchain/pool.go:262.22,264.12 2 0
github.com/tendermint/tendermint/blockchain/pool.go:266.51,267.12 1 1
github.com/tendermint/tendermint/blockchain/pool.go:269.30,270.12 1 1
github.com/tendermint/tendermint/blockchain/pool.go:278.44,290.2 8 1
github.com/tendermint/tendermint/blockchain/pool.go:292.63,293.23 1 1
github.com/tendermint/tendermint/blockchain/pool.go:296.2,296.49 1 1
github.com/tendermint/tendermint/blockchain/pool.go:293.23,295.3 1 0
github.com/tendermint/tendermint/blockchain/pool.go:299.51,300.23 1 1
github.com/tendermint/tendermint/blockchain/pool.go:303.2,303.27 1 1
github.com/tendermint/tendermint/blockchain/pool.go:300.23,302.3 1 0
github.com/tendermint/tendermint/blockchain/pool.go:307.39,312.66 4 0
github.com/tendermint/tendermint/blockchain/pool.go:320.2,320.12 1 0
github.com/tendermint/tendermint/blockchain/pool.go:312.66,313.32 1 0
github.com/tendermint/tendermint/blockchain/pool.go:313.32,315.4 1 0
github.com/tendermint/tendermint/blockchain/pool.go:315.4,318.4 2 0
github.com/tendermint/tendermint/blockchain/pool.go:338.68,347.2 2 1
github.com/tendermint/tendermint/blockchain/pool.go:349.45,351.2 1 1
github.com/tendermint/tendermint/blockchain/pool.go:353.36,357.2 3 1
github.com/tendermint/tendermint/blockchain/pool.go:359.36,360.25 1 1
github.com/tendermint/tendermint/blockchain/pool.go:360.25,362.3 1 1
github.com/tendermint/tendermint/blockchain/pool.go:362.3,364.3 1 1
github.com/tendermint/tendermint/blockchain/pool.go:367.35,368.26 1 1
github.com/tendermint/tendermint/blockchain/pool.go:372.2,372.19 1 1
github.com/tendermint/tendermint/blockchain/pool.go:368.26,371.3 2 1
github.com/tendermint/tendermint/blockchain/pool.go:375.47,377.26 2 1
github.com/tendermint/tendermint/blockchain/pool.go:377.26,379.3 1 1
github.com/tendermint/tendermint/blockchain/pool.go:379.3,382.3 2 1
github.com/tendermint/tendermint/blockchain/pool.go:385.33,392.2 5 1
github.com/tendermint/tendermint/blockchain/pool.go:408.63,420.2 3 1
github.com/tendermint/tendermint/blockchain/pool.go:422.41,425.2 2 1
github.com/tendermint/tendermint/blockchain/pool.go:428.74,430.46 2 1
github.com/tendermint/tendermint/blockchain/pool.go:434.2,438.13 4 1
github.com/tendermint/tendermint/blockchain/pool.go:430.46,433.3 2 0
github.com/tendermint/tendermint/blockchain/pool.go:441.49,445.2 3 1
github.com/tendermint/tendermint/blockchain/pool.go:447.44,451.2 3 0
github.com/tendermint/tendermint/blockchain/pool.go:453.33,458.2 4 0
github.com/tendermint/tendermint/blockchain/pool.go:462.32,464.2 1 0
github.com/tendermint/tendermint/blockchain/pool.go:468.42,470.6 1 1
github.com/tendermint/tendermint/blockchain/pool.go:470.6,474.7 2 1
github.com/tendermint/tendermint/blockchain/pool.go:486.3,492.10 5 1
github.com/tendermint/tendermint/blockchain/pool.go:474.7,475.49 1 1
github.com/tendermint/tendermint/blockchain/pool.go:478.4,479.19 2 1
github.com/tendermint/tendermint/blockchain/pool.go:484.4,484.24 1 1
github.com/tendermint/tendermint/blockchain/pool.go:475.49,477.5 1 1
github.com/tendermint/tendermint/blockchain/pool.go:479.19,482.28 2 1
github.com/tendermint/tendermint/blockchain/pool.go:493.24,495.10 2 1
github.com/tendermint/tendermint/blockchain/pool.go:496.19,497.10 1 0
github.com/tendermint/tendermint/blockchain/pool.go:498.21,500.23 2 0
github.com/tendermint/tendermint/blockchain/pool.go:501.25,503.11 1 1
github.com/tendermint/tendermint/blockchain/pool.go:504.25,506.11 2 1
github.com/tendermint/tendermint/blockchain/pool.go:507.20,508.11 1 0
github.com/tendermint/tendermint/blockchain/pool.go:509.22,511.24 2 0
github.com/tendermint/tendermint/blockchain/reactor.go:55.134,56.47 1 1
github.com/tendermint/tendermint/blockchain/reactor.go:59.2,59.45 1 1
github.com/tendermint/tendermint/blockchain/reactor.go:62.2,79.12 6 1
github.com/tendermint/tendermint/blockchain/reactor.go:56.47,58.3 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:59.45,61.3 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:83.47,85.18 2 1
github.com/tendermint/tendermint/blockchain/reactor.go:92.2,92.12 1 1
github.com/tendermint/tendermint/blockchain/reactor.go:85.18,87.17 2 1
github.com/tendermint/tendermint/blockchain/reactor.go:90.3,90.23 1 1
github.com/tendermint/tendermint/blockchain/reactor.go:87.17,89.4 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:96.40,99.2 2 1
github.com/tendermint/tendermint/blockchain/reactor.go:102.70,110.2 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:113.54,114.110 1 1
github.com/tendermint/tendermint/blockchain/reactor.go:114.110,116.3 0 0
github.com/tendermint/tendermint/blockchain/reactor.go:120.77,122.2 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:128.101,130.18 2 1
github.com/tendermint/tendermint/blockchain/reactor.go:135.2,139.4 2 1
github.com/tendermint/tendermint/blockchain/reactor.go:130.18,133.3 2 1
github.com/tendermint/tendermint/blockchain/reactor.go:143.81,145.16 2 1
github.com/tendermint/tendermint/blockchain/reactor.go:150.2,153.27 2 1
github.com/tendermint/tendermint/blockchain/reactor.go:145.16,148.3 2 0
github.com/tendermint/tendermint/blockchain/reactor.go:154.30,155.53 1 1
github.com/tendermint/tendermint/blockchain/reactor.go:158.31,160.57 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:161.31,164.14 2 0
github.com/tendermint/tendermint/blockchain/reactor.go:167.32,169.48 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:170.10,171.76 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:155.53,157.4 0 0
github.com/tendermint/tendermint/blockchain/reactor.go:164.14,166.4 0 0
github.com/tendermint/tendermint/blockchain/reactor.go:177.48,179.2 1 1
github.com/tendermint/tendermint/blockchain/reactor.go:184.45,191.6 4 1
github.com/tendermint/tendermint/blockchain/reactor.go:191.6,192.10 1 1
github.com/tendermint/tendermint/blockchain/reactor.go:193.36,195.19 2 0
github.com/tendermint/tendermint/blockchain/reactor.go:198.4,200.15 3 0
github.com/tendermint/tendermint/blockchain/reactor.go:205.35,208.19 2 0
github.com/tendermint/tendermint/blockchain/reactor.go:211.31,213.35 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:214.36,219.29 4 0
github.com/tendermint/tendermint/blockchain/reactor.go:228.26,231.28 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:267.4,267.21 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:268.19,269.18 1 1
github.com/tendermint/tendermint/blockchain/reactor.go:195.19,196.22 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:200.15,203.22 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:208.19,210.5 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:219.29,226.19 5 0
github.com/tendermint/tendermint/blockchain/reactor.go:231.28,235.38 2 0
github.com/tendermint/tendermint/blockchain/reactor.go:239.5,247.19 4 0
github.com/tendermint/tendermint/blockchain/reactor.go:235.38,237.21 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:247.19,250.21 3 0
github.com/tendermint/tendermint/blockchain/reactor.go:251.6,261.20 4 0
github.com/tendermint/tendermint/blockchain/reactor.go:261.20,264.7 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:275.62,278.2 2 0
github.com/tendermint/tendermint/blockchain/reactor.go:281.70,283.2 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:310.93,315.32 5 1
github.com/tendermint/tendermint/blockchain/reactor.go:318.2,318.8 1 1
github.com/tendermint/tendermint/blockchain/reactor.go:315.32,317.3 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:327.49,329.2 1 1
github.com/tendermint/tendermint/blockchain/reactor.go:335.54,337.2 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:346.50,348.2 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:356.50,358.2 1 0
github.com/tendermint/tendermint/blockchain/reactor.go:366.51,368.2 1 0
github.com/tendermint/tendermint/blockchain/store.go:40.43,46.2 2 1
github.com/tendermint/tendermint/blockchain/store.go:49.36,53.2 3 1
github.com/tendermint/tendermint/blockchain/store.go:58.55,60.18 2 1
github.com/tendermint/tendermint/blockchain/store.go:63.2,63.31 1 1
github.com/tendermint/tendermint/blockchain/store.go:60.18,62.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:68.58,72.14 4 1
github.com/tendermint/tendermint/blockchain/store.go:75.2,76.16 2 1
github.com/tendermint/tendermint/blockchain/store.go:79.2,80.59 2 1
github.com/tendermint/tendermint/blockchain/store.go:84.2,85.16 2 1
github.com/tendermint/tendermint/blockchain/store.go:88.2,88.14 1 1
github.com/tendermint/tendermint/blockchain/store.go:72.14,74.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:76.16,78.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:80.59,83.3 2 1
github.com/tendermint/tendermint/blockchain/store.go:85.16,87.3 1 0
github.com/tendermint/tendermint/blockchain/store.go:94.72,98.14 4 1
github.com/tendermint/tendermint/blockchain/store.go:101.2,102.16 2 1
github.com/tendermint/tendermint/blockchain/store.go:105.2,105.13 1 1
github.com/tendermint/tendermint/blockchain/store.go:98.14,100.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:102.16,104.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:110.66,114.14 4 1
github.com/tendermint/tendermint/blockchain/store.go:117.2,118.16 2 1
github.com/tendermint/tendermint/blockchain/store.go:121.2,121.18 1 1
github.com/tendermint/tendermint/blockchain/store.go:114.14,116.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:118.16,120.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:128.65,132.14 4 1
github.com/tendermint/tendermint/blockchain/store.go:135.2,136.16 2 1
github.com/tendermint/tendermint/blockchain/store.go:139.2,139.15 1 1
github.com/tendermint/tendermint/blockchain/store.go:132.14,134.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:136.16,138.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:145.64,149.14 4 1
github.com/tendermint/tendermint/blockchain/store.go:152.2,153.16 2 1
github.com/tendermint/tendermint/blockchain/store.go:156.2,156.15 1 1
github.com/tendermint/tendermint/blockchain/store.go:149.14,151.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:153.16,155.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:165.106,166.18 1 1
github.com/tendermint/tendermint/blockchain/store.go:169.2,170.43 2 1
github.com/tendermint/tendermint/blockchain/store.go:173.2,173.30 1 1
github.com/tendermint/tendermint/blockchain/store.go:178.2,183.42 4 1
github.com/tendermint/tendermint/blockchain/store.go:188.2,205.25 9 1
github.com/tendermint/tendermint/blockchain/store.go:166.18,168.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:170.43,172.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:173.30,175.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:183.42,185.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:208.78,209.29 1 1
github.com/tendermint/tendermint/blockchain/store.go:212.2,213.55 2 1
github.com/tendermint/tendermint/blockchain/store.go:209.29,211.3 1 0
github.com/tendermint/tendermint/blockchain/store.go:218.42,220.2 1 1
github.com/tendermint/tendermint/blockchain/store.go:222.57,224.2 1 1
github.com/tendermint/tendermint/blockchain/store.go:226.44,228.2 1 1
github.com/tendermint/tendermint/blockchain/store.go:230.43,232.2 1 1
github.com/tendermint/tendermint/blockchain/store.go:243.48,245.16 2 1
github.com/tendermint/tendermint/blockchain/store.go:248.2,248.34 1 1
github.com/tendermint/tendermint/blockchain/store.go:245.16,247.3 1 0
github.com/tendermint/tendermint/blockchain/store.go:253.61,255.18 2 1
github.com/tendermint/tendermint/blockchain/store.go:260.2,262.16 3 1
github.com/tendermint/tendermint/blockchain/store.go:265.2,265.12 1 1
github.com/tendermint/tendermint/blockchain/store.go:255.18,259.3 1 1
github.com/tendermint/tendermint/blockchain/store.go:262.16,264.3 1 1

+ 16
- 32
blockchain/store_test.go View File

@ -138,6 +138,7 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
// End of setup, test data
commitAtH10 := &types.Commit{Precommits: []*types.Vote{{Height: 10}}}
tuples := []struct {
block *types.Block
parts *types.PartSet
@ -152,10 +153,7 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
eraseSeenCommitInDB bool
}{
{
block: &types.Block{
Header: &header1,
LastCommit: &types.Commit{Precommits: []*types.Vote{{Height: 10}}},
},
block: newBlock(&header1, commitAtH10),
parts: validPartSet,
seenCommit: seenCommit1,
},
@ -166,28 +164,19 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
},
{
block: &types.Block{
Header: &header2,
LastCommit: &types.Commit{Precommits: []*types.Vote{{Height: 10}}},
},
block: newBlock(&header2, commitAtH10),
parts: uncontiguousPartSet,
wantPanic: "only save contiguous blocks", // and incomplete and uncontiguous parts
},
{
block: &types.Block{
Header: &header1,
LastCommit: &types.Commit{Precommits: []*types.Vote{{Height: 10}}},
},
block: newBlock(&header1, commitAtH10),
parts: incompletePartSet,
wantPanic: "only save complete block", // incomplete parts
},
{
block: &types.Block{
Header: &header1,
LastCommit: &types.Commit{Precommits: []*types.Vote{{Height: 10}}},
},
block: newBlock(&header1, commitAtH10),
parts: validPartSet,
seenCommit: seenCommit1,
corruptCommitInDB: true, // Corrupt the DB's commit entry
@ -195,10 +184,7 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
},
{
block: &types.Block{
Header: &header1,
LastCommit: &types.Commit{Precommits: []*types.Vote{{Height: 10}}},
},
block: newBlock(&header1, commitAtH10),
parts: validPartSet,
seenCommit: seenCommit1,
wantPanic: "rror reading block",
@ -206,10 +192,7 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
},
{
block: &types.Block{
Header: &header1,
LastCommit: &types.Commit{Precommits: []*types.Vote{{Height: 10}}},
},
block: newBlock(&header1, commitAtH10),
parts: validPartSet,
seenCommit: seenCommit1,
@ -218,10 +201,7 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
},
{
block: &types.Block{
Header: &header1,
LastCommit: &types.Commit{Precommits: []*types.Vote{{Height: 10}}},
},
block: newBlock(&header1, commitAtH10),
parts: validPartSet,
seenCommit: seenCommit1,
@ -230,10 +210,7 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
},
{
block: &types.Block{
Header: &header1,
LastCommit: &types.Commit{Precommits: []*types.Vote{{Height: 10}}},
},
block: newBlock(&header1, commitAtH10),
parts: validPartSet,
seenCommit: seenCommit1,
@ -422,3 +399,10 @@ func doFn(fn func() (interface{}, error)) (res interface{}, err error, panicErr
res, err = fn()
return res, err, panicErr
}
func newBlock(hdr *types.Header, lastCommit *types.Commit) *types.Block {
return &types.Block{
Header: hdr,
LastCommit: lastCommit,
}
}

Loading…
Cancel
Save