routing/chainview: convert chainview integration tests to use sub-tests

This commit is contained in:
Olaoluwa Osuntokun committed 2017-07-04 15:53:58 -07:00
1 parent 3b1db2b186
commit 9daa659bb3
1 file changed
+28 -5
+28 -5
View File
@@ -451,10 +451,24 @@ func testFilterSingleBlock(node *rpctest.Harness, chainView FilteredChainView,
expectedTxns) expectedTxns)
} }
var chainViewTests = []func(*rpctest.Harness, FilteredChainView, *testing.T){ type testCase struct {
testFilterBlockNotifications, name string
testUpdateFilterBackTrack, test func(*rpctest.Harness, FilteredChainView, *testing.T)
testFilterSingleBlock, }
var chainViewTests = []testCase{
{
name: "filtered block ntfns",
test: testFilterBlockNotifications,
},
{
name: "update filter back track",
test: testUpdateFilterBackTrack,
},
{
name: "fitler single block",
test: testFilterSingleBlock,
},
} }
var interfaceImpls = []struct { var interfaceImpls = []struct {
@@ -553,7 +567,16 @@ func TestFilteredChainView(t *testing.T) {
t.Fatalf("unable to start chain view: %v", err) t.Fatalf("unable to start chain view: %v", err)
} }
for _, chainViewTest := range chainViewTests { for _, chainViewTest := range chainViewTests {
chainViewTest(miner, chainView, t) testName := fmt.Sprintf("%v: %v", chainViewImpl.name,
chainViewTest.name)
success := t.Run(testName, func(t *testing.T) {
chainViewTest.test(miner, chainView, t)
})
if !success {
break
}
} }
if err := chainView.Stop(); err != nil { if err := chainView.Stop(); err != nil {