routing/chainview: convert chainview integration tests to use sub-tests
This commit is contained in:
1 file changed
+28
-5
@@ -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 {
|
||||||
|
|||||||
Reference in new issue
Block a user