From 79b6ffe65196a9303c6536f210dc3e5d12749c7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 8 Aug 2023 13:53:24 +0200 Subject: [PATCH] ci: Drop legacy cc-replace itests --- .circleci/config.yml | 24 ----- itests/ccupgrade_test.go | 131 ------------------------ itests/sector_make_cc_avail_test.go | 78 -------------- itests/sector_prefer_no_upgrade_test.go | 90 ---------------- itests/sector_revert_available_test.go | 85 --------------- 5 files changed, 408 deletions(-) delete mode 100644 itests/ccupgrade_test.go delete mode 100644 itests/sector_make_cc_avail_test.go delete mode 100644 itests/sector_prefer_no_upgrade_test.go delete mode 100644 itests/sector_revert_available_test.go diff --git a/.circleci/config.yml b/.circleci/config.yml index b1566e6b0..9489c9896 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -545,12 +545,6 @@ workflows: - build suite: itest-batch_deal target: "./itests/batch_deal_test.go" - - test: - name: test-itest-ccupgrade - requires: - - build - suite: itest-ccupgrade - target: "./itests/ccupgrade_test.go" - test: name: test-itest-cli requires: @@ -906,12 +900,6 @@ workflows: - build suite: itest-sector_import_simple target: "./itests/sector_import_simple_test.go" - - test: - name: test-itest-sector_make_cc_avail - requires: - - build - suite: itest-sector_make_cc_avail - target: "./itests/sector_make_cc_avail_test.go" - test: name: test-itest-sector_miner_collateral requires: @@ -930,18 +918,6 @@ workflows: - build suite: itest-sector_pledge target: "./itests/sector_pledge_test.go" - - test: - name: test-itest-sector_prefer_no_upgrade - requires: - - build - suite: itest-sector_prefer_no_upgrade - target: "./itests/sector_prefer_no_upgrade_test.go" - - test: - name: test-itest-sector_revert_available - requires: - - build - suite: itest-sector_revert_available - target: "./itests/sector_revert_available_test.go" - test: name: test-itest-sector_terminate requires: diff --git a/itests/ccupgrade_test.go b/itests/ccupgrade_test.go deleted file mode 100644 index 030e115f8..000000000 --- a/itests/ccupgrade_test.go +++ /dev/null @@ -1,131 +0,0 @@ -// stm: #integration -package itests - -import ( - "context" - "fmt" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/go-state-types/network" - - "github.com/filecoin-project/lotus/chain/types" - "github.com/filecoin-project/lotus/itests/kit" -) - -func TestCCUpgrade(t *testing.T) { - //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 - - //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: @MINER_SECTOR_LIST_001 - kit.QuietMiningLogs() - - n := runTestCCUpgrade(t) - - t.Run("post", func(t *testing.T) { - ctx := context.Background() - ts, err := n.ChainHead(ctx) - require.NoError(t, err) - start := ts.Height() - // wait for a full proving period - t.Log("waiting for chain") - - n.WaitTillChain(ctx, func(ts *types.TipSet) bool { - if ts.Height() > start+abi.ChainEpoch(2880) { - return true - } - return false - }) - }) -} - -func runTestCCUpgrade(t *testing.T) *kit.TestFullNode { - ctx := context.Background() - blockTime := 1 * time.Millisecond - - client, miner, ens := kit.EnsembleMinimal(t, kit.GenesisNetworkVersion(network.Version15), kit.ThroughRPC()) - ens.InterconnectAll().BeginMiningMustPost(blockTime) - - maddr, err := miner.ActorAddress(ctx) - if err != nil { - t.Fatal(err) - } - - CCUpgrade := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner) - fmt.Printf("CCUpgrade: %d\n", CCUpgrade) - - miner.PledgeSectors(ctx, 1, 0, nil) - sl, err := miner.SectorsListNonGenesis(ctx) - require.NoError(t, err) - require.Len(t, sl, 1, "expected 1 sector") - require.Equal(t, CCUpgrade, sl[0], "unexpected sector number") - - si, err := client.StateSectorGetInfo(ctx, maddr, CCUpgrade, types.EmptyTSK) - require.NoError(t, err) - require.NotNil(t, si) - require.Less(t, 50000, int(si.Expiration)) - require.True(t, si.ReplacedSectorAge == 0) - - client.WaitForSectorActive(ctx, t, CCUpgrade, maddr) - - //stm: @SECTOR_CC_UPGRADE_001 - err = miner.SectorMarkForUpgrade(ctx, sl[0], true) - require.NoError(t, err) - - sl, err = miner.SectorsListNonGenesis(ctx) - require.NoError(t, err) - require.Len(t, sl, 1, "expected 1 sector") - - dh := kit.NewDealHarness(t, client, miner, miner) - deal, res, inPath := dh.MakeOnlineDeal(ctx, kit.MakeFullDealParams{ - Rseed: 6, - SuspendUntilCryptoeconStable: true, - }) - outPath := dh.PerformRetrieval(context.Background(), deal, res.Root, false) - kit.AssertFilesEqual(t, inPath, outPath) - - status, err := miner.SectorsStatus(ctx, CCUpgrade, true) - require.NoError(t, err) - assert.Equal(t, 1, len(status.Deals)) - - miner.WaitSectorsProving(ctx, map[abi.SectorNumber]struct{}{ - CCUpgrade: {}, - }) - - siUpdate, err := client.StateSectorGetInfo(ctx, maddr, CCUpgrade, types.EmptyTSK) - require.NoError(t, err) - require.NotNil(t, siUpdate) - require.True(t, siUpdate.SectorKeyCID != nil) - require.True(t, siUpdate.Activation > si.Activation) - - return client -} - -func TestCCUpgradeAndPoSt(t *testing.T) { - kit.QuietMiningLogs() - t.Run("upgrade and then post", func(t *testing.T) { - ctx := context.Background() - n := runTestCCUpgrade(t) - ts, err := n.ChainHead(ctx) - require.NoError(t, err) - start := ts.Height() - // wait for a full proving period - t.Log("waiting for chain") - - n.WaitTillChain(ctx, func(ts *types.TipSet) bool { - if ts.Height() > start+abi.ChainEpoch(2880) { - return true - } - return false - }) - }) -} diff --git a/itests/sector_make_cc_avail_test.go b/itests/sector_make_cc_avail_test.go deleted file mode 100644 index 524b3c70f..000000000 --- a/itests/sector_make_cc_avail_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package itests - -import ( - "context" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/filecoin-project/go-state-types/abi" - "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/itests/kit" - "github.com/filecoin-project/lotus/node/config" - sealing "github.com/filecoin-project/lotus/storage/pipeline" -) - -func TestMakeAvailable(t *testing.T) { - kit.QuietMiningLogs() - - ctx := context.Background() - blockTime := 1 * time.Millisecond - - client, miner, ens := kit.EnsembleMinimal(t, kit.GenesisNetworkVersion(network.Version15), kit.ThroughRPC(), kit.MutateSealingConfig(func(sc *config.SealingConfig) { - sc.MakeCCSectorsAvailable = true - })) - ens.InterconnectAll().BeginMiningMustPost(blockTime) - - maddr, err := miner.ActorAddress(ctx) - if err != nil { - t.Fatal(err) - } - - CCUpgrade := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner) - - miner.PledgeSectors(ctx, 1, 0, nil) - sl, err := miner.SectorsListNonGenesis(ctx) - require.NoError(t, err) - require.Len(t, sl, 1, "expected 1 sector") - require.Equal(t, CCUpgrade, sl[0], "unexpected sector number") - { - si, err := client.StateSectorGetInfo(ctx, maddr, CCUpgrade, types.EmptyTSK) - require.NoError(t, err) - require.NotNil(t, si) - require.Less(t, 50000, int(si.Expiration)) - } - client.WaitForSectorActive(ctx, t, CCUpgrade, maddr) - - sl, err = miner.SectorsListNonGenesis(ctx) - require.NoError(t, err) - require.Len(t, sl, 1, "expected 1 sector") - - status, err := miner.SectorsStatus(ctx, CCUpgrade, true) - require.NoError(t, err) - assert.Equal(t, api.SectorState(sealing.Available), status.State) - - dh := kit.NewDealHarness(t, client, miner, miner) - deal, res, inPath := dh.MakeOnlineDeal(ctx, kit.MakeFullDealParams{ - Rseed: 6, - SuspendUntilCryptoeconStable: true, - }) - outPath := dh.PerformRetrieval(context.Background(), deal, res.Root, false) - kit.AssertFilesEqual(t, inPath, outPath) - - sl, err = miner.SectorsListNonGenesis(ctx) - require.NoError(t, err) - require.Len(t, sl, 1, "expected 1 sector") - - status, err = miner.SectorsStatus(ctx, CCUpgrade, true) - require.NoError(t, err) - assert.Equal(t, 1, len(status.Deals)) - miner.WaitSectorsProving(ctx, map[abi.SectorNumber]struct{}{ - CCUpgrade: {}, - }) -} diff --git a/itests/sector_prefer_no_upgrade_test.go b/itests/sector_prefer_no_upgrade_test.go deleted file mode 100644 index 96f07f9e4..000000000 --- a/itests/sector_prefer_no_upgrade_test.go +++ /dev/null @@ -1,90 +0,0 @@ -package itests - -import ( - "context" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/filecoin-project/go-state-types/abi" - "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/itests/kit" - "github.com/filecoin-project/lotus/node/config" - sealing "github.com/filecoin-project/lotus/storage/pipeline" -) - -func TestPreferNoUpgrade(t *testing.T) { - kit.QuietMiningLogs() - - ctx := context.Background() - blockTime := 1 * time.Millisecond - - client, miner, ens := kit.EnsembleMinimal(t, kit.GenesisNetworkVersion(network.Version15), kit.ThroughRPC(), kit.MutateSealingConfig(func(sc *config.SealingConfig) { - sc.PreferNewSectorsForDeals = true - })) - ens.InterconnectAll().BeginMiningMustPost(blockTime) - - maddr, err := miner.ActorAddress(ctx) - if err != nil { - t.Fatal(err) - } - - CCUpgrade := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner) - Sealed := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner + 1) - - { - miner.PledgeSectors(ctx, 1, 0, nil) - sl, err := miner.SectorsListNonGenesis(ctx) - require.NoError(t, err) - require.Len(t, sl, 1, "expected 1 sector") - require.Equal(t, CCUpgrade, sl[0], "unexpected sector number") - { - si, err := client.StateSectorGetInfo(ctx, maddr, CCUpgrade, types.EmptyTSK) - require.NoError(t, err) - require.NotNil(t, si) - require.Less(t, 50000, int(si.Expiration)) - } - client.WaitForSectorActive(ctx, t, CCUpgrade, maddr) - - err = miner.SectorMarkForUpgrade(ctx, sl[0], true) - require.NoError(t, err) - - sl, err = miner.SectorsListNonGenesis(ctx) - require.NoError(t, err) - require.Len(t, sl, 1, "expected 1 sector") - } - - { - dh := kit.NewDealHarness(t, client, miner, miner) - deal, res, inPath := dh.MakeOnlineDeal(ctx, kit.MakeFullDealParams{ - Rseed: 6, - SuspendUntilCryptoeconStable: true, - }) - outPath := dh.PerformRetrieval(context.Background(), deal, res.Root, false) - kit.AssertFilesEqual(t, inPath, outPath) - } - - sl, err := miner.SectorsListNonGenesis(ctx) - require.NoError(t, err) - require.Len(t, sl, 2, "expected 2 sectors") - - { - status, err := miner.SectorsStatus(ctx, CCUpgrade, true) - require.NoError(t, err) - assert.Equal(t, api.SectorState(sealing.Available), status.State) - } - - { - status, err := miner.SectorsStatus(ctx, Sealed, true) - require.NoError(t, err) - assert.Equal(t, 1, len(status.Deals)) - miner.WaitSectorsProving(ctx, map[abi.SectorNumber]struct{}{ - Sealed: {}, - }) - } -} diff --git a/itests/sector_revert_available_test.go b/itests/sector_revert_available_test.go deleted file mode 100644 index 41a46024f..000000000 --- a/itests/sector_revert_available_test.go +++ /dev/null @@ -1,85 +0,0 @@ -package itests - -import ( - "context" - "fmt" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/filecoin-project/go-state-types/abi" - "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/itests/kit" - sealing "github.com/filecoin-project/lotus/storage/pipeline" -) - -func TestAbortUpgradeAvailable(t *testing.T) { - kit.QuietMiningLogs() - - ctx := context.Background() - blockTime := 1 * time.Millisecond - - client, miner, ens := kit.EnsembleMinimal(t, kit.GenesisNetworkVersion(network.Version15), kit.ThroughRPC()) - ens.InterconnectAll().BeginMiningMustPost(blockTime) - - maddr, err := miner.ActorAddress(ctx) - if err != nil { - t.Fatal(err) - } - - CCUpgrade := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner) - fmt.Printf("CCUpgrade: %d\n", CCUpgrade) - - miner.PledgeSectors(ctx, 1, 0, nil) - sl, err := miner.SectorsListNonGenesis(ctx) - require.NoError(t, err) - require.Len(t, sl, 1, "expected 1 sector") - require.Equal(t, CCUpgrade, sl[0], "unexpected sector number") - { - si, err := client.StateSectorGetInfo(ctx, maddr, CCUpgrade, types.EmptyTSK) - require.NoError(t, err) - require.NotNil(t, si) - require.Less(t, 50000, int(si.Expiration)) - } - client.WaitForSectorActive(ctx, t, CCUpgrade, maddr) - - err = miner.SectorMarkForUpgrade(ctx, sl[0], true) - require.NoError(t, err) - - sl, err = miner.SectorsListNonGenesis(ctx) - require.NoError(t, err) - require.Len(t, sl, 1, "expected 1 sector") - - ss, err := miner.SectorsStatus(ctx, sl[0], false) - require.NoError(t, err) - - for i := 0; i < 100; i++ { - ss, err = miner.SectorsStatus(ctx, sl[0], false) - require.NoError(t, err) - if ss.State == api.SectorState(sealing.Proving) { - time.Sleep(50 * time.Millisecond) - continue - } - - require.Equal(t, api.SectorState(sealing.Available), ss.State) - break - } - - require.NoError(t, miner.SectorAbortUpgrade(ctx, sl[0])) - - for i := 0; i < 100; i++ { - ss, err = miner.SectorsStatus(ctx, sl[0], false) - require.NoError(t, err) - if ss.State == api.SectorState(sealing.Available) { - time.Sleep(50 * time.Millisecond) - continue - } - - require.Equal(t, api.SectorState(sealing.Proving), ss.State) - break - } -}