50 lines
1.5 KiB
Go
50 lines
1.5 KiB
Go
package itests
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
"github.com/filecoin-project/lotus/itests/kit"
|
|
)
|
|
|
|
func TestDealCyclesConcurrent(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("skipping test in short mode")
|
|
}
|
|
|
|
kit.QuietMiningLogs()
|
|
|
|
blockTime := 10 * time.Millisecond
|
|
|
|
// For these tests where the block time is artificially short, just use
|
|
// a deal start epoch that is guaranteed to be far enough in the future
|
|
// so that the deal starts sealing in time
|
|
startEpoch := abi.ChainEpoch(2 << 12)
|
|
|
|
runTest := func(t *testing.T, n int, fastRetrieval bool, carExport bool) {
|
|
client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs())
|
|
ens.InterconnectAll().BeginMining(blockTime)
|
|
dh := kit.NewDealHarness(t, client, miner)
|
|
|
|
dh.RunConcurrentDeals(kit.RunConcurrentDealsOpts{
|
|
N: n,
|
|
FastRetrieval: fastRetrieval,
|
|
CarExport: carExport,
|
|
StartEpoch: startEpoch,
|
|
})
|
|
}
|
|
|
|
// TODO: add 2, 4, 8, more when this graphsync issue is fixed: https://github.com/ipfs/go-graphsync/issues/175#
|
|
cycles := []int{1}
|
|
for _, n := range cycles {
|
|
n := n
|
|
ns := fmt.Sprintf("%d", n)
|
|
t.Run(ns+"-fastretrieval-CAR", func(t *testing.T) { runTest(t, n, true, true) })
|
|
t.Run(ns+"-fastretrieval-NoCAR", func(t *testing.T) { runTest(t, n, true, false) })
|
|
t.Run(ns+"-stdretrieval-CAR", func(t *testing.T) { runTest(t, n, true, false) })
|
|
t.Run(ns+"-stdretrieval-NoCAR", func(t *testing.T) { runTest(t, n, false, false) })
|
|
}
|
|
}
|