2022-08-29 14:25:30 +00:00
// stm: #integration
2021-07-01 19:07:53 +00:00
package itests
import (
"context"
"fmt"
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/filecoin-project/lotus/itests/kit"
"github.com/filecoin-project/lotus/node/config"
2022-07-12 10:42:08 +00:00
"github.com/filecoin-project/lotus/storage/paths"
2021-07-01 19:07:53 +00:00
)
func TestDealsWithFinalizeEarly ( t * testing . T ) {
2021-12-13 12:41:04 +00:00
//stm: @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001,
//stm: @CHAIN_SYNCER_START_001, @CHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01
//stm: @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
2021-12-14 10:33:33 +00:00
//stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001
2021-12-15 14:30:42 +00:00
//stm: @STORAGE_INFO_001
2021-07-01 19:07:53 +00:00
if testing . Short ( ) {
t . Skip ( "skipping test in short mode" )
}
kit . QuietMiningLogs ( )
var blockTime = 50 * time . Millisecond
2022-03-17 20:13:18 +00:00
client , miner , ens := kit . EnsembleMinimal ( t , kit . ThroughRPC ( ) , kit . MutateSealingConfig ( func ( sc * config . SealingConfig ) { sc . FinalizeEarly = true } ) ) // no mock proofs.
2021-07-01 19:07:53 +00:00
ens . InterconnectAll ( ) . BeginMining ( blockTime )
2021-07-05 11:36:23 +00:00
dh := kit . NewDealHarness ( t , client , miner , miner )
2021-07-01 19:07:53 +00:00
ctx := context . Background ( )
2022-07-12 10:42:08 +00:00
miner . AddStorage ( ctx , t , func ( meta * paths . LocalStorageMeta ) {
meta . Weight = 1000000000
meta . CanSeal = true
} )
miner . AddStorage ( ctx , t , func ( meta * paths . LocalStorageMeta ) {
meta . Weight = 1000000000
meta . CanStore = true
} )
2021-07-01 19:07:53 +00:00
2021-12-15 14:30:42 +00:00
//stm: @STORAGE_LIST_001
2021-07-01 19:07:53 +00:00
sl , err := miner . StorageList ( ctx )
require . NoError ( t , err )
for si , d := range sl {
i , err := miner . StorageInfo ( ctx , si )
require . NoError ( t , err )
fmt . Printf ( "stor d:%d %+v\n" , len ( d ) , i )
}
t . Run ( "single" , func ( t * testing . T ) {
dh . RunConcurrentDeals ( kit . RunConcurrentDealsOpts { N : 1 } )
} )
2021-12-15 14:30:42 +00:00
//stm: @STORAGE_LIST_001
2021-07-01 19:07:53 +00:00
sl , err = miner . StorageList ( ctx )
require . NoError ( t , err )
for si , d := range sl {
i , err := miner . StorageInfo ( ctx , si )
require . NoError ( t , err )
fmt . Printf ( "stor d:%d %+v\n" , len ( d ) , i )
}
}