diff --git a/blockstore/splitstore/splitstore_compact.go b/blockstore/splitstore/splitstore_compact.go index f96f9d37033..668951bf03c 100644 --- a/blockstore/splitstore/splitstore_compact.go +++ b/blockstore/splitstore/splitstore_compact.go @@ -502,7 +502,7 @@ func (s *SplitStore) applyProtectors() error { }) if err != nil { - return xerrors.Errorf("error applynig protector: %w", err) + return xerrors.Errorf("error applying protector: %w", err) } } diff --git a/itests/splitstore_test.go b/itests/splitstore_test.go index ea59faf2a9f..b3684cd290b 100644 --- a/itests/splitstore_test.go +++ b/itests/splitstore_test.go @@ -180,10 +180,18 @@ func TestColdStorePrune(t *testing.T) { break } } + pruneOpts := api.PruneOpts{RetainState: int64(0), MovingGC: false} - require.NoError(t, full.ChainPrune(ctx, pruneOpts)) - bm.Restart() - waitForPrune(ctx, t, 1, full) + for { + require.NoError(t, full.ChainPrune(ctx, pruneOpts)) + time.Sleep(5 * time.Second) + if splitStorePruneIndex(ctx, t, full) >= 1 { + break + } + + t.Log("prune hasn't started for some reason, resending prune request") + } + assert.False(g.t, g.Exists(ctx, garbageS), "Garbage state should be removed from cold store after prune but it's still there") assert.True(g.t, g.Exists(ctx, garbageM), "Garbage message should be on the cold store after prune") } @@ -301,15 +309,6 @@ func waitForCompaction(ctx context.Context, t *testing.T, cIdx int64, n *kit.Tes } } -func waitForPrune(ctx context.Context, t *testing.T, pIdx int64, n *kit.TestFullNode) { - for { - if splitStorePruneIndex(ctx, t, n) >= pIdx { - break - } - time.Sleep(1 * time.Second) - } -} - func splitStoreCompacting(ctx context.Context, t *testing.T, n *kit.TestFullNode) bool { info, err := n.ChainBlockstoreInfo(ctx) require.NoError(t, err)