2021-06-10 12:25:36 +00:00
|
|
|
package itests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
2021-06-22 11:08:36 +00:00
|
|
|
"github.com/filecoin-project/lotus/chain/actors/policy"
|
2021-06-18 18:45:29 +00:00
|
|
|
"github.com/filecoin-project/lotus/itests/kit"
|
2021-06-10 12:25:36 +00:00
|
|
|
)
|
|
|
|
|
2021-06-11 17:26:25 +00:00
|
|
|
func TestDealsWithSealingAndRPC(t *testing.T) {
|
|
|
|
if testing.Short() {
|
|
|
|
t.Skip("skipping test in short mode")
|
|
|
|
}
|
|
|
|
|
2021-06-18 18:45:29 +00:00
|
|
|
kit.QuietMiningLogs()
|
2021-06-11 17:26:25 +00:00
|
|
|
|
2021-06-22 11:08:36 +00:00
|
|
|
oldDelay := policy.GetPreCommitChallengeDelay()
|
|
|
|
policy.SetPreCommitChallengeDelay(5)
|
|
|
|
t.Cleanup(func() {
|
|
|
|
policy.SetPreCommitChallengeDelay(oldDelay)
|
|
|
|
})
|
|
|
|
|
2021-06-11 17:26:25 +00:00
|
|
|
var blockTime = 1 * time.Second
|
|
|
|
|
2021-06-22 10:05:59 +00:00
|
|
|
client, miner, ens := kit.EnsembleMinimal(t, kit.ThroughRPC(), kit.WithAllSubsystems()) // no mock proofs.
|
2021-06-11 17:26:25 +00:00
|
|
|
ens.InterconnectAll().BeginMining(blockTime)
|
2021-06-23 09:24:55 +00:00
|
|
|
dh := kit.NewDealHarness(t, client, miner, miner)
|
2021-06-11 17:26:25 +00:00
|
|
|
|
|
|
|
t.Run("stdretrieval", func(t *testing.T) {
|
2021-06-23 17:13:29 +00:00
|
|
|
dh.RunConcurrentDeals(kit.RunConcurrentDealsOpts{N: 1})
|
2021-06-23 09:56:09 +00:00
|
|
|
})
|
|
|
|
|
2021-06-11 17:26:25 +00:00
|
|
|
t.Run("fastretrieval", func(t *testing.T) {
|
2021-06-23 17:13:29 +00:00
|
|
|
dh.RunConcurrentDeals(kit.RunConcurrentDealsOpts{N: 1, FastRetrieval: true})
|
2021-06-22 11:08:36 +00:00
|
|
|
})
|
|
|
|
|
2021-06-11 17:26:25 +00:00
|
|
|
t.Run("fastretrieval-twodeals-sequential", func(t *testing.T) {
|
2021-06-23 17:13:29 +00:00
|
|
|
dh.RunConcurrentDeals(kit.RunConcurrentDealsOpts{N: 1, FastRetrieval: true})
|
|
|
|
dh.RunConcurrentDeals(kit.RunConcurrentDealsOpts{N: 1, FastRetrieval: true})
|
2021-06-13 22:43:22 +00:00
|
|
|
})
|
|
|
|
}
|