From 3a52f0569225567f1b3c67776e696a27d0635ab2 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Wed, 12 Jan 2022 15:53:15 +0400 Subject: [PATCH] green ci --- itests/deals_anycid_test.go | 4 +-- itests/kit/deals.go | 31 +++++++--------------- markets/dagstore/wrapper_migration_test.go | 3 --- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/itests/deals_anycid_test.go b/itests/deals_anycid_test.go index 87bb93562..2c9fc2d9b 100644 --- a/itests/deals_anycid_test.go +++ b/itests/deals_anycid_test.go @@ -88,7 +88,7 @@ func TestDealRetrieveByAnyCid(t *testing.T) { require.NoError(t, err) cids := prepared.Cids() for i, c := range cids { - blk, err := bs.Get(c) + blk, err := bs.Get(ctx, c) require.NoError(t, err) nd, err := ipld.Decode(blk) @@ -129,7 +129,7 @@ func TestDealRetrieveByAnyCid(t *testing.T) { require.Empty(t, offer.Err) // retrieve in a CAR file and ensure roots match - outputCar := dh.PerformRetrievalForOffer(ctx, true, offer) + outputCar := dh.PerformRetrieval(ctx, dealCid, targetCid, true) _, err = os.Stat(outputCar) require.NoError(t, err) f, err := os.Open(outputCar) diff --git a/itests/kit/deals.go b/itests/kit/deals.go index fdda6f036..b2a571e40 100644 --- a/itests/kit/deals.go +++ b/itests/kit/deals.go @@ -306,23 +306,19 @@ func (dh *DealHarness) StartSealingWaiting(ctx context.Context) { } } -func (dh *DealHarness) PerformRetrieval(ctx context.Context, dealCid *cid.Cid, root cid.Cid, carExport bool) (path string) { +func (dh *DealHarness) PerformRetrieval(ctx context.Context, deal *cid.Cid, root cid.Cid, carExport bool) (path string) { // perform retrieval. - info, err := dh.client.ClientGetDealInfo(ctx, *dealCid) + info, err := dh.client.ClientGetDealInfo(ctx, *deal) require.NoError(dh.t, err) offers, err := dh.client.ClientFindData(ctx, root, &info.PieceCID) require.NoError(dh.t, err) require.NotEmpty(dh.t, offers, "no offers") - return dh.PerformRetrievalForOffer(ctx, carExport, offers[0]) -} - -func (dh *DealHarness) PerformRetrievalForOffer(ctx context.Context, carExport bool, offer api.QueryOffer) string { - outputF, err := ioutil.TempFile(dh.t.TempDir(), "ret-car") + carFile, err := ioutil.TempFile(dh.t.TempDir(), "ret-car") require.NoError(dh.t, err) - defer outputF.Close() //nolint:errcheck + defer carFile.Close() //nolint:errcheck caddr, err := dh.client.WalletDefaultAddress(ctx) require.NoError(dh.t, err) @@ -366,21 +362,14 @@ consumeEvents: Path: carFile.Name(), IsCAR: carExport, })) - ref := &api.FileRef{ - Path: outputF.Name(), - IsCAR: carExport, + + ret := carFile.Name() + if carExport { + actualFile := dh.ExtractFileFromCAR(ctx, carFile) + ret = actualFile.Name() + _ = actualFile.Close() //nolint:errcheck } - order := offer.Order(caddr) - updates, err := dh.client.ClientRetrieveWithEvents(ctx, order, ref) - require.NoError(dh.t, err) - - for update := range updates { - require.Emptyf(dh.t, update.Err, "retrieval failed: %s", update.Err) - } - - ret := outputF.Name() - return ret } diff --git a/markets/dagstore/wrapper_migration_test.go b/markets/dagstore/wrapper_migration_test.go index 756fa5857..4c143a3e6 100644 --- a/markets/dagstore/wrapper_migration_test.go +++ b/markets/dagstore/wrapper_migration_test.go @@ -10,7 +10,6 @@ import ( "github.com/filecoin-project/dagstore" "github.com/stretchr/testify/require" - "github.com/filecoin-project/dagstore" "github.com/filecoin-project/dagstore/mount" "github.com/filecoin-project/go-state-types/abi" @@ -100,11 +99,9 @@ func TestShardRegistration(t *testing.T) { cfg.RootDir = t.TempDir() mapi := NewMinerAPI(ps, &wrappedSA{sa}, 10) - dagst, w, err := NewDAGStore(cfg, mapi) h, err := mocknet.New(ctx).GenPeer() require.NoError(t, err) - mapi := NewMinerAPI(ps, sa, 10) dagst, w, err := NewDAGStore(cfg, mapi, h) require.NoError(t, err) require.NotNil(t, dagst)