itests: TestTooManyMarkedForUpgrade is not applicable anymore
This commit is contained in:
parent
9a854e9ab7
commit
a9d757f3a0
@ -10,7 +10,6 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/network"
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/itests/kit"
|
"github.com/filecoin-project/lotus/itests/kit"
|
||||||
|
|
||||||
@ -89,18 +88,6 @@ func runTestCCUpgrade(t *testing.T) *kit.TestFullNode {
|
|||||||
return client
|
return client
|
||||||
}
|
}
|
||||||
|
|
||||||
func waitForDeadline(ctx context.Context, t *testing.T, waitIdx uint64, node *kit.TestFullNode, maddr address.Address) {
|
|
||||||
for {
|
|
||||||
ts, err := node.ChainHead(ctx)
|
|
||||||
require.NoError(t, err)
|
|
||||||
dl, err := node.StateMinerProvingDeadline(ctx, maddr, ts.Key())
|
|
||||||
require.NoError(t, err)
|
|
||||||
if dl.Index == waitIdx {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func waitForSectorActive(ctx context.Context, t *testing.T, sn abi.SectorNumber, node *kit.TestFullNode, maddr address.Address) {
|
func waitForSectorActive(ctx context.Context, t *testing.T, sn abi.SectorNumber, node *kit.TestFullNode, maddr address.Address) {
|
||||||
for {
|
for {
|
||||||
active, err := node.StateMinerActiveSectors(ctx, maddr, types.EmptyTSK)
|
active, err := node.StateMinerActiveSectors(ctx, maddr, types.EmptyTSK)
|
||||||
@ -116,18 +103,6 @@ func waitForSectorActive(ctx context.Context, t *testing.T, sn abi.SectorNumber,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func waitForSectorStartUpgrade(ctx context.Context, t *testing.T, sn abi.SectorNumber, miner *kit.TestMiner) {
|
|
||||||
for {
|
|
||||||
si, err := miner.StorageMiner.SectorsStatus(ctx, sn, false)
|
|
||||||
require.NoError(t, err)
|
|
||||||
if si.State != api.SectorState("Proving") {
|
|
||||||
t.Logf("Done proving sector in state: %s", si.State)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCCUpgradeAndPoSt(t *testing.T) {
|
func TestCCUpgradeAndPoSt(t *testing.T) {
|
||||||
kit.QuietMiningLogs()
|
kit.QuietMiningLogs()
|
||||||
t.Run("upgrade and then post", func(t *testing.T) {
|
t.Run("upgrade and then post", func(t *testing.T) {
|
||||||
@ -147,48 +122,3 @@ func TestCCUpgradeAndPoSt(t *testing.T) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTooManyMarkedForUpgrade(t *testing.T) {
|
|
||||||
kit.QuietMiningLogs()
|
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
blockTime := 1 * time.Millisecond
|
|
||||||
|
|
||||||
client, miner, ens := kit.EnsembleMinimal(t, kit.GenesisNetworkVersion(network.Version15))
|
|
||||||
ens.InterconnectAll().BeginMiningMustPost(blockTime)
|
|
||||||
|
|
||||||
maddr, err := miner.ActorAddress(ctx)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
CCUpgrade := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner + 1)
|
|
||||||
waitForDeadline(ctx, t, 1, client, maddr)
|
|
||||||
miner.PledgeSectors(ctx, 3, 0, nil)
|
|
||||||
|
|
||||||
sl, err := miner.SectorsList(ctx)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Len(t, sl, 3, "expected 3 sectors")
|
|
||||||
|
|
||||||
{
|
|
||||||
si, err := client.StateSectorGetInfo(ctx, maddr, CCUpgrade, types.EmptyTSK)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Less(t, 50000, int(si.Expiration))
|
|
||||||
}
|
|
||||||
|
|
||||||
waitForSectorActive(ctx, t, CCUpgrade, client, maddr)
|
|
||||||
waitForSectorActive(ctx, t, CCUpgrade+1, client, maddr)
|
|
||||||
waitForSectorActive(ctx, t, CCUpgrade+2, client, maddr)
|
|
||||||
|
|
||||||
err = miner.SectorMarkForUpgrade(ctx, CCUpgrade, true)
|
|
||||||
require.NoError(t, err)
|
|
||||||
err = miner.SectorMarkForUpgrade(ctx, CCUpgrade+1, true)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
waitForSectorStartUpgrade(ctx, t, CCUpgrade, miner)
|
|
||||||
waitForSectorStartUpgrade(ctx, t, CCUpgrade+1, miner)
|
|
||||||
|
|
||||||
err = miner.SectorMarkForUpgrade(ctx, CCUpgrade+2, true)
|
|
||||||
require.Error(t, err)
|
|
||||||
assert.Contains(t, err.Error(), "no free resources to wait for deals")
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user