From 2d16af6ee60c75cf762c407152bcc62f8ccddf7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 30 Sep 2020 19:18:38 +0200 Subject: [PATCH] sectorstorage: Fix TestRedoPC1 --- extern/sector-storage/manager_test.go | 3 +++ extern/sector-storage/mock/mock.go | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/extern/sector-storage/manager_test.go b/extern/sector-storage/manager_test.go index d87ec0827..fe82c0ca0 100644 --- a/extern/sector-storage/manager_test.go +++ b/extern/sector-storage/manager_test.go @@ -198,6 +198,9 @@ func TestRedoPC1(t *testing.T) { _, err = m.SealPreCommit1(ctx, sid, ticket, pieces) require.NoError(t, err) + // tell mock ffi that we expect PC1 again + require.NoError(t, tw.mockSeal.ForceState(sid, 0)) // sectorPacking + _, err = m.SealPreCommit1(ctx, sid, ticket, pieces) require.NoError(t, err) diff --git a/extern/sector-storage/mock/mock.go b/extern/sector-storage/mock/mock.go index a292c2bbb..8eb65482d 100644 --- a/extern/sector-storage/mock/mock.go +++ b/extern/sector-storage/mock/mock.go @@ -127,6 +127,19 @@ func (mgr *SectorMgr) AcquireSectorNumber() (abi.SectorNumber, error) { return id, nil } +func (mgr *SectorMgr) ForceState(sid abi.SectorID, st int) error { + mgr.lk.Lock() + ss, ok := mgr.sectors[sid] + mgr.lk.Unlock() + if !ok { + return xerrors.Errorf("no sector with id %d in storage", sid) + } + + ss.state = st + + return nil +} + func (mgr *SectorMgr) SealPreCommit1(ctx context.Context, sid abi.SectorID, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storage.PreCommit1Out, err error) { mgr.lk.Lock() ss, ok := mgr.sectors[sid]