itests: rename Builder methods.

This commit is contained in:
Raúl Kripalani 2021-05-20 12:17:41 +01:00
parent 06b8ee5b95
commit 1902c4c687
15 changed files with 39 additions and 39 deletions

View File

@ -17,7 +17,7 @@ import (
"github.com/stretchr/testify/require"
)
type testSuite struct {
type apiSuite struct {
makeNodes kit.APIBuilder
}
@ -31,7 +31,7 @@ func TestAPIRPC(t *testing.T) {
// runAPITest is the entry point to API test suite
func runAPITest(t *testing.T, b kit.APIBuilder) {
ts := testSuite{
ts := apiSuite{
makeNodes: b,
}
@ -44,7 +44,7 @@ func runAPITest(t *testing.T, b kit.APIBuilder) {
t.Run("testNonGenesisMiner", ts.testNonGenesisMiner)
}
func (ts *testSuite) testVersion(t *testing.T) {
func (ts *apiSuite) testVersion(t *testing.T) {
lapi.RunningNodeType = lapi.NodeFull
t.Cleanup(func() {
lapi.RunningNodeType = lapi.NodeUnknown
@ -65,7 +65,7 @@ func (ts *testSuite) testVersion(t *testing.T) {
require.Equal(t, versions[0], build.BuildVersion)
}
func (ts *testSuite) testSearchMsg(t *testing.T) {
func (ts *apiSuite) testSearchMsg(t *testing.T) {
apis, miners := ts.makeNodes(t, kit.OneFull, kit.OneMiner)
api := apis[0]
@ -108,7 +108,7 @@ func (ts *testSuite) testSearchMsg(t *testing.T) {
}
func (ts *testSuite) testID(t *testing.T) {
func (ts *apiSuite) testID(t *testing.T) {
ctx := context.Background()
apis, _ := ts.makeNodes(t, kit.OneFull, kit.OneMiner)
api := apis[0]
@ -120,7 +120,7 @@ func (ts *testSuite) testID(t *testing.T) {
assert.Regexp(t, "^12", id.Pretty())
}
func (ts *testSuite) testConnectTwo(t *testing.T) {
func (ts *apiSuite) testConnectTwo(t *testing.T) {
ctx := context.Background()
apis, _ := ts.makeNodes(t, kit.TwoFull, kit.OneMiner)
@ -166,7 +166,7 @@ func (ts *testSuite) testConnectTwo(t *testing.T) {
}
}
func (ts *testSuite) testMining(t *testing.T) {
func (ts *apiSuite) testMining(t *testing.T) {
ctx := context.Background()
fulls, miners := ts.makeNodes(t, kit.OneFull, kit.OneMiner)
api := fulls[0]
@ -191,7 +191,7 @@ func (ts *testSuite) testMining(t *testing.T) {
require.Greater(t, int64(h2.Height()), int64(h1.Height()))
}
func (ts *testSuite) testMiningReal(t *testing.T) {
func (ts *apiSuite) testMiningReal(t *testing.T) {
build.InsecurePoStValidation = false
defer func() {
build.InsecurePoStValidation = true
@ -230,7 +230,7 @@ func (ts *testSuite) testMiningReal(t *testing.T) {
require.Greater(t, int64(h3.Height()), int64(h2.Height()))
}
func (ts *testSuite) testNonGenesisMiner(t *testing.T) {
func (ts *apiSuite) testNonGenesisMiner(t *testing.T) {
ctx := context.Background()
n, sn := ts.makeNodes(t,
[]kit.FullNodeOpts{kit.FullNodeWithLatestActorsAt(-1)},

View File

@ -54,7 +54,7 @@ func TestBatchDealInput(t *testing.T) {
}}
// Create a connect client and miner node
n, sn := kit.MockSbBuilder(t, kit.OneFull, minerDef)
n, sn := kit.MockMinerBuilder(t, kit.OneFull, minerDef)
client := n[0].FullNode.(*impl.FullNodeAPI)
miner := sn[0]
s := kit.ConnectAndStartMining(t, blockTime, client, miner)

View File

@ -27,7 +27,7 @@ func TestCCUpgrade(t *testing.T) {
} {
height := height // make linters happy by copying
t.Run(fmt.Sprintf("upgrade-%d", height), func(t *testing.T) {
runTestCCUpgrade(t, kit.MockSbBuilder, 5*time.Millisecond, height)
runTestCCUpgrade(t, kit.MockMinerBuilder, 5*time.Millisecond, height)
})
}
}

View File

@ -75,7 +75,7 @@ func TestDeadlineToggling(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
n, sn := kit.MockSbBuilder(t, []kit.FullNodeOpts{kit.FullNodeWithLatestActorsAt(upgradeH)}, kit.OneMiner)
n, sn := kit.MockMinerBuilder(t, []kit.FullNodeOpts{kit.FullNodeWithLatestActorsAt(upgradeH)}, kit.OneMiner)
client := n[0].FullNode.(*impl.FullNodeAPI)
minerA := sn[0]

View File

@ -35,19 +35,19 @@ func TestDealCycle(t *testing.T) {
dealStartEpoch := abi.ChainEpoch(2 << 12)
t.Run("TestFullDealCycle_Single", func(t *testing.T) {
runFullDealCycles(t, 1, kit.MockSbBuilder, blockTime, false, false, dealStartEpoch)
runFullDealCycles(t, 1, kit.MockMinerBuilder, blockTime, false, false, dealStartEpoch)
})
t.Run("TestFullDealCycle_Two", func(t *testing.T) {
runFullDealCycles(t, 2, kit.MockSbBuilder, blockTime, false, false, dealStartEpoch)
runFullDealCycles(t, 2, kit.MockMinerBuilder, blockTime, false, false, dealStartEpoch)
})
t.Run("WithExportedCAR", func(t *testing.T) {
runFullDealCycles(t, 1, kit.MockSbBuilder, blockTime, true, false, dealStartEpoch)
runFullDealCycles(t, 1, kit.MockMinerBuilder, blockTime, true, false, dealStartEpoch)
})
t.Run("TestFastRetrievalDealCycle", func(t *testing.T) {
runFastRetrievalDealFlowT(t, kit.MockSbBuilder, blockTime, dealStartEpoch)
runFastRetrievalDealFlowT(t, kit.MockMinerBuilder, blockTime, dealStartEpoch)
})
t.Run("TestZeroPricePerByteRetrievalDealFlow", func(t *testing.T) {
runZeroPricePerByteRetrievalDealFlow(t, kit.MockSbBuilder, blockTime, dealStartEpoch)
runZeroPricePerByteRetrievalDealFlow(t, kit.MockMinerBuilder, blockTime, dealStartEpoch)
})
}
@ -81,7 +81,7 @@ func TestAPIDealFlowReal(t *testing.T) {
func TestPublishDealsBatching(t *testing.T) {
kit.QuietMiningLogs()
b := kit.MockSbBuilder
b := kit.MockMinerBuilder
blocktime := 10 * time.Millisecond
startEpoch := abi.ChainEpoch(2 << 12)
@ -183,7 +183,7 @@ func TestDealMining(t *testing.T) {
kit.QuietMiningLogs()
b := kit.MockSbBuilder
b := kit.MockMinerBuilder
blocktime := 50 * time.Millisecond
ctx := context.Background()

View File

@ -292,7 +292,7 @@ func startNodes(
},
},
)
n, sn := kit.RPCMockSbBuilder(t, opts, kit.OneMiner)
n, sn := kit.RPCMockMinerBuilder(t, opts, kit.OneMiner)
full := n[0]
lite := n[1]

View File

@ -12,7 +12,7 @@ import (
)
func StartOneNodeOneMiner(ctx context.Context, t *testing.T, blocktime time.Duration) (TestFullNode, address.Address) {
n, sn := RPCMockSbBuilder(t, OneFull, OneMiner)
n, sn := RPCMockMinerBuilder(t, OneFull, OneMiner)
full := n[0]
miner := sn[0]
@ -43,7 +43,7 @@ func StartOneNodeOneMiner(ctx context.Context, t *testing.T, blocktime time.Dura
}
func StartTwoNodesOneMiner(ctx context.Context, t *testing.T, blocktime time.Duration) ([]TestFullNode, []address.Address) {
n, sn := RPCMockSbBuilder(t, TwoFull, OneMiner)
n, sn := RPCMockMinerBuilder(t, TwoFull, OneMiner)
fullNode1 := n[0]
fullNode2 := n[1]

View File

@ -203,16 +203,16 @@ func Builder(t *testing.T, fullOpts []FullNodeOpts, storage []StorageMiner) ([]T
return mockBuilderOpts(t, fullOpts, storage, false)
}
func MockSbBuilder(t *testing.T, fullOpts []FullNodeOpts, storage []StorageMiner) ([]TestFullNode, []TestMiner) {
return mockSbBuilderOpts(t, fullOpts, storage, false)
}
func RPCBuilder(t *testing.T, fullOpts []FullNodeOpts, storage []StorageMiner) ([]TestFullNode, []TestMiner) {
return mockBuilderOpts(t, fullOpts, storage, true)
}
func RPCMockSbBuilder(t *testing.T, fullOpts []FullNodeOpts, storage []StorageMiner) ([]TestFullNode, []TestMiner) {
return mockSbBuilderOpts(t, fullOpts, storage, true)
func MockMinerBuilder(t *testing.T, fullOpts []FullNodeOpts, storage []StorageMiner) ([]TestFullNode, []TestMiner) {
return mockMinerBuilderOpts(t, fullOpts, storage, false)
}
func RPCMockMinerBuilder(t *testing.T, fullOpts []FullNodeOpts, storage []StorageMiner) ([]TestFullNode, []TestMiner) {
return mockMinerBuilderOpts(t, fullOpts, storage, true)
}
func mockBuilderOpts(t *testing.T, fullOpts []FullNodeOpts, storage []StorageMiner, rpc bool) ([]TestFullNode, []TestMiner) {
@ -381,7 +381,7 @@ func mockBuilderOpts(t *testing.T, fullOpts []FullNodeOpts, storage []StorageMin
return fulls, miners
}
func mockSbBuilderOpts(t *testing.T, fullOpts []FullNodeOpts, storage []StorageMiner, rpc bool) ([]TestFullNode, []TestMiner) {
func mockMinerBuilderOpts(t *testing.T, fullOpts []FullNodeOpts, storage []StorageMiner, rpc bool) ([]TestFullNode, []TestMiner) {
ctx, cancel := context.WithCancel(context.Background())
t.Cleanup(cancel)

View File

@ -30,7 +30,7 @@ func TestPaymentChannelsAPI(t *testing.T) {
kit.QuietMiningLogs()
ctx := context.Background()
n, sn := kit.MockSbBuilder(t, kit.TwoFull, kit.OneMiner)
n, sn := kit.MockMinerBuilder(t, kit.TwoFull, kit.OneMiner)
paymentCreator := n[0]
paymentReceiver := n[1]

View File

@ -32,7 +32,7 @@ func TestSDRUpgrade(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
n, sn := kit.MockSbBuilder(t, []kit.FullNodeOpts{kit.FullNodeWithSDRAt(500, 1000)}, kit.OneMiner)
n, sn := kit.MockMinerBuilder(t, []kit.FullNodeOpts{kit.FullNodeWithSDRAt(500, 1000)}, kit.OneMiner)
client := n[0].FullNode.(*impl.FullNodeAPI)
miner := sn[0]

View File

@ -17,11 +17,11 @@ func TestPledgeSectors(t *testing.T) {
kit.QuietMiningLogs()
t.Run("1", func(t *testing.T) {
runPledgeSectorTest(t, kit.MockSbBuilder, 50*time.Millisecond, 1)
runPledgeSectorTest(t, kit.MockMinerBuilder, 50*time.Millisecond, 1)
})
t.Run("100", func(t *testing.T) {
runPledgeSectorTest(t, kit.MockSbBuilder, 50*time.Millisecond, 100)
runPledgeSectorTest(t, kit.MockMinerBuilder, 50*time.Millisecond, 100)
})
t.Run("1000", func(t *testing.T) {
@ -29,7 +29,7 @@ func TestPledgeSectors(t *testing.T) {
t.Skip("skipping test in short mode")
}
runPledgeSectorTest(t, kit.MockSbBuilder, 50*time.Millisecond, 1000)
runPledgeSectorTest(t, kit.MockMinerBuilder, 50*time.Millisecond, 1000)
})
}

View File

@ -31,7 +31,7 @@ func TestTerminate(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
n, sn := kit.MockSbBuilder(t,
n, sn := kit.MockMinerBuilder(t,
[]kit.FullNodeOpts{kit.FullNodeWithLatestActorsAt(-1)},
[]kit.StorageMiner{{Full: 0, Preseal: int(nSectors)}},
)

View File

@ -25,7 +25,7 @@ func TestTapeFix(t *testing.T) {
// The "before" case is disabled, because we need the builder to mock 32 GiB sectors to accurately repro this case
// TODO: Make the mock sector size configurable and reenable this
// t.Run("before", func(t *testing.T) { testTapeFix(t, b, blocktime, false) })
t.Run("after", func(t *testing.T) { testTapeFix(t, kit.MockSbBuilder, blocktime, true) })
t.Run("after", func(t *testing.T) { testTapeFix(t, kit.MockMinerBuilder, blocktime, true) })
}
func testTapeFix(t *testing.T, b kit.APIBuilder, blocktime time.Duration, after bool) {

View File

@ -29,7 +29,7 @@ func TestWindowPostDispute(t *testing.T) {
kit.QuietMiningLogs()
b := kit.MockSbBuilder
b := kit.MockMinerBuilder
blocktime := 2 * time.Millisecond
ctx, cancel := context.WithCancel(context.Background())
@ -260,7 +260,7 @@ func TestWindowPostDisputeFails(t *testing.T) {
kit.QuietMiningLogs()
b := kit.MockSbBuilder
b := kit.MockMinerBuilder
blocktime := 2 * time.Millisecond
ctx, cancel := context.WithCancel(context.Background())

View File

@ -39,7 +39,7 @@ func TestWindowedPost(t *testing.T) {
} {
height := height // copy to satisfy lints
t.Run(fmt.Sprintf("upgrade-%d", height), func(t *testing.T) {
testWindowPostUpgrade(t, kit.MockSbBuilder, blocktime, nSectors, height)
testWindowPostUpgrade(t, kit.MockMinerBuilder, blocktime, nSectors, height)
})
}
}