Annotate storage miner features

This commit is contained in:
Darko Brdareski 2021-12-15 15:30:42 +01:00
parent be1123b5df
commit 2f1f35cc71
12 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,4 @@
//stm: #unit
package sectorstorage package sectorstorage
import ( import (
@ -211,6 +212,7 @@ func TestRedoPC1(t *testing.T) {
// Manager restarts in the middle of a task, restarts it, it completes // Manager restarts in the middle of a task, restarts it, it completes
func TestRestartManager(t *testing.T) { func TestRestartManager(t *testing.T) {
//stm: @WORKER_JOBS_001
test := func(returnBeforeCall bool) func(*testing.T) { test := func(returnBeforeCall bool) func(*testing.T) {
return func(t *testing.T) { return func(t *testing.T) {
logging.SetAllLoggers(logging.LevelDebug) logging.SetAllLoggers(logging.LevelDebug)
@ -355,6 +357,7 @@ func TestRestartWorker(t *testing.T) {
<-arch <-arch
require.NoError(t, w.Close()) require.NoError(t, w.Close())
//stm: @WORKER_STATS_001
for { for {
if len(m.WorkerStats()) == 0 { if len(m.WorkerStats()) == 0 {
break break
@ -417,6 +420,7 @@ func TestReenableWorker(t *testing.T) {
// disable // disable
atomic.StoreInt64(&w.testDisable, 1) atomic.StoreInt64(&w.testDisable, 1)
//stm: @WORKER_STATS_001
for i := 0; i < 100; i++ { for i := 0; i < 100; i++ {
if !m.WorkerStats()[w.session].Enabled { if !m.WorkerStats()[w.session].Enabled {
break break

View File

@ -1,3 +1,4 @@
//stm: #unit
package sectorstorage package sectorstorage
import ( import (
@ -188,6 +189,7 @@ func TestSchedStartStop(t *testing.T) {
} }
func TestSched(t *testing.T) { func TestSched(t *testing.T) {
//stm: @WORKER_JOBS_001
ctx, done := context.WithTimeout(context.Background(), 30*time.Second) ctx, done := context.WithTimeout(context.Background(), 30*time.Second)
defer done() defer done()

View File

@ -1,3 +1,4 @@
//stm: #unit
package stores_test package stores_test
import ( import (
@ -153,6 +154,7 @@ func TestMoveShared(t *testing.T) {
} }
func TestReader(t *testing.T) { func TestReader(t *testing.T) {
//stm: @STORAGE_INFO_001
logging.SetAllLoggers(logging.LevelDebug) logging.SetAllLoggers(logging.LevelDebug)
bz := []byte("Hello World") bz := []byte("Hello World")

View File

@ -22,6 +22,8 @@ func TestCCUpgrade(t *testing.T) {
//stm: @CHAIN_STATE_MINER_GET_INFO_001 //stm: @CHAIN_STATE_MINER_GET_INFO_001
//stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001 //stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001
//stm: @MINER_SECTOR_LIST_001
kit.QuietMiningLogs() kit.QuietMiningLogs()
for _, height := range []abi.ChainEpoch{ for _, height := range []abi.ChainEpoch{
@ -64,6 +66,7 @@ func runTestCCUpgrade(t *testing.T, upgradeHeight abi.ChainEpoch) {
require.Less(t, 50000, int(si.Expiration)) require.Less(t, 50000, int(si.Expiration))
} }
//stm: @SECTOR_CC_UPGRADE_001
err = miner.SectorMarkForUpgrade(ctx, sl[0]) err = miner.SectorMarkForUpgrade(ctx, sl[0])
require.NoError(t, err) require.NoError(t, err)

View File

@ -59,6 +59,7 @@ func TestDeadlineToggling(t *testing.T) {
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001 //stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
//stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001 //stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001
//stm: @MINER_SECTOR_LIST_001
kit.Expensive(t) kit.Expensive(t)
kit.QuietMiningLogs() kit.QuietMiningLogs()

View File

@ -63,11 +63,13 @@ func TestQuotePriceForUnsealedRetrieval(t *testing.T) {
require.Equal(t, dealInfo.Size*uint64(ppb), offers[0].MinPrice.Uint64()) require.Equal(t, dealInfo.Size*uint64(ppb), offers[0].MinPrice.Uint64())
// remove ONLY one unsealed file // remove ONLY one unsealed file
//stm: @STORAGE_LIST_001, @MINER_SECTOR_LIST_001
ss, err := miner.StorageList(context.Background()) ss, err := miner.StorageList(context.Background())
require.NoError(t, err) require.NoError(t, err)
_, err = miner.SectorsList(ctx) _, err = miner.SectorsList(ctx)
require.NoError(t, err) require.NoError(t, err)
//stm: @STORAGE_DROP_SECTOR_001, @STORAGE_LIST_001
iLoop: iLoop:
for storeID, sd := range ss { for storeID, sd := range ss {
for _, sector := range sd { for _, sector := range sd {

View File

@ -25,6 +25,8 @@ func TestSDRUpgrade(t *testing.T) {
//stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001 //stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001
//stm: @CHAIN_STATE_NETWORK_VERSION_001 //stm: @CHAIN_STATE_NETWORK_VERSION_001
//stm: @MINER_SECTOR_LIST_001
kit.QuietMiningLogs() kit.QuietMiningLogs()
// oldDelay := policy.GetPreCommitChallengeDelay() // oldDelay := policy.GetPreCommitChallengeDelay()

View File

@ -25,6 +25,7 @@ func TestDealsWithFinalizeEarly(t *testing.T) {
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001 //stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
//stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001 //stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001
//stm: @STORAGE_INFO_001
if testing.Short() { if testing.Short() {
t.Skip("skipping test in short mode") t.Skip("skipping test in short mode")
} }
@ -49,6 +50,7 @@ func TestDealsWithFinalizeEarly(t *testing.T) {
miner.AddStorage(ctx, t, 1000000000, true, false) miner.AddStorage(ctx, t, 1000000000, true, false)
miner.AddStorage(ctx, t, 1000000000, false, true) miner.AddStorage(ctx, t, 1000000000, false, true)
//stm: @STORAGE_LIST_001
sl, err := miner.StorageList(ctx) sl, err := miner.StorageList(ctx)
require.NoError(t, err) require.NoError(t, err)
for si, d := range sl { for si, d := range sl {
@ -62,6 +64,7 @@ func TestDealsWithFinalizeEarly(t *testing.T) {
dh.RunConcurrentDeals(kit.RunConcurrentDealsOpts{N: 1}) dh.RunConcurrentDeals(kit.RunConcurrentDealsOpts{N: 1})
}) })
//stm: @STORAGE_LIST_001
sl, err = miner.StorageList(ctx) sl, err = miner.StorageList(ctx)
require.NoError(t, err) require.NoError(t, err)
for si, d := range sl { for si, d := range sl {

View File

@ -28,6 +28,7 @@ func TestMinerBalanceCollateral(t *testing.T) {
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001 //stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
//stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001 //stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001
//stm: @MINER_SECTOR_LIST_001
kit.QuietMiningLogs() kit.QuietMiningLogs()
blockTime := 5 * time.Millisecond blockTime := 5 * time.Millisecond

View File

@ -61,6 +61,7 @@ func TestPledgeSectors(t *testing.T) {
} }
func TestPledgeBatching(t *testing.T) { func TestPledgeBatching(t *testing.T) {
//stm: @SECTOR_PRE_COMMIT_FLUSH_001, @SECTOR_COMMIT_FLUSH_001
blockTime := 50 * time.Millisecond blockTime := 50 * time.Millisecond
runTest := func(t *testing.T, nSectors int) { runTest := func(t *testing.T, nSectors int) {

View File

@ -77,6 +77,7 @@ func TestTerminate(t *testing.T) {
toTerminate := abi.SectorNumber(3) toTerminate := abi.SectorNumber(3)
//stm: @SECTOR_TERMINATE_001
err = miner.SectorTerminate(ctx, toTerminate) err = miner.SectorTerminate(ctx, toTerminate)
require.NoError(t, err) require.NoError(t, err)
@ -89,6 +90,7 @@ loop:
t.Log("state: ", si.State, msgTriggerred) t.Log("state: ", si.State, msgTriggerred)
switch sealing.SectorState(si.State) { switch sealing.SectorState(si.State) {
//stm: @SECTOR_TERMINATE_PENDING_001
case sealing.Terminating: case sealing.Terminating:
if !msgTriggerred { if !msgTriggerred {
{ {

View File

@ -90,6 +90,7 @@ func TestWindowPostDispute(t *testing.T) {
// make sure it has gained power. // make sure it has gained power.
require.Equal(t, p.MinerPower.RawBytePower, types.NewInt(uint64(ssz))) require.Equal(t, p.MinerPower.RawBytePower, types.NewInt(uint64(ssz)))
//stm: @MINER_SECTOR_LIST_001
evilSectors, err := evilMiner.SectorsList(ctx) evilSectors, err := evilMiner.SectorsList(ctx)
require.NoError(t, err) require.NoError(t, err)
evilSectorNo := evilSectors[0] // only one. evilSectorNo := evilSectors[0] // only one.