green ci
This commit is contained in:
parent
64bf3fccd2
commit
3a52f05692
@ -88,7 +88,7 @@ func TestDealRetrieveByAnyCid(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
cids := prepared.Cids()
|
cids := prepared.Cids()
|
||||||
for i, c := range cids {
|
for i, c := range cids {
|
||||||
blk, err := bs.Get(c)
|
blk, err := bs.Get(ctx, c)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
nd, err := ipld.Decode(blk)
|
nd, err := ipld.Decode(blk)
|
||||||
@ -129,7 +129,7 @@ func TestDealRetrieveByAnyCid(t *testing.T) {
|
|||||||
require.Empty(t, offer.Err)
|
require.Empty(t, offer.Err)
|
||||||
|
|
||||||
// retrieve in a CAR file and ensure roots match
|
// 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)
|
_, err = os.Stat(outputCar)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
f, err := os.Open(outputCar)
|
f, err := os.Open(outputCar)
|
||||||
|
@ -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.
|
// perform retrieval.
|
||||||
info, err := dh.client.ClientGetDealInfo(ctx, *dealCid)
|
info, err := dh.client.ClientGetDealInfo(ctx, *deal)
|
||||||
require.NoError(dh.t, err)
|
require.NoError(dh.t, err)
|
||||||
|
|
||||||
offers, err := dh.client.ClientFindData(ctx, root, &info.PieceCID)
|
offers, err := dh.client.ClientFindData(ctx, root, &info.PieceCID)
|
||||||
require.NoError(dh.t, err)
|
require.NoError(dh.t, err)
|
||||||
require.NotEmpty(dh.t, offers, "no offers")
|
require.NotEmpty(dh.t, offers, "no offers")
|
||||||
|
|
||||||
return dh.PerformRetrievalForOffer(ctx, carExport, offers[0])
|
carFile, err := ioutil.TempFile(dh.t.TempDir(), "ret-car")
|
||||||
}
|
|
||||||
|
|
||||||
func (dh *DealHarness) PerformRetrievalForOffer(ctx context.Context, carExport bool, offer api.QueryOffer) string {
|
|
||||||
outputF, err := ioutil.TempFile(dh.t.TempDir(), "ret-car")
|
|
||||||
require.NoError(dh.t, err)
|
require.NoError(dh.t, err)
|
||||||
|
|
||||||
defer outputF.Close() //nolint:errcheck
|
defer carFile.Close() //nolint:errcheck
|
||||||
|
|
||||||
caddr, err := dh.client.WalletDefaultAddress(ctx)
|
caddr, err := dh.client.WalletDefaultAddress(ctx)
|
||||||
require.NoError(dh.t, err)
|
require.NoError(dh.t, err)
|
||||||
@ -366,21 +362,14 @@ consumeEvents:
|
|||||||
Path: carFile.Name(),
|
Path: carFile.Name(),
|
||||||
IsCAR: carExport,
|
IsCAR: carExport,
|
||||||
}))
|
}))
|
||||||
ref := &api.FileRef{
|
|
||||||
Path: outputF.Name(),
|
ret := carFile.Name()
|
||||||
IsCAR: carExport,
|
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
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"github.com/filecoin-project/dagstore"
|
"github.com/filecoin-project/dagstore"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/filecoin-project/dagstore"
|
|
||||||
"github.com/filecoin-project/dagstore/mount"
|
"github.com/filecoin-project/dagstore/mount"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
|
||||||
@ -100,11 +99,9 @@ func TestShardRegistration(t *testing.T) {
|
|||||||
cfg.RootDir = t.TempDir()
|
cfg.RootDir = t.TempDir()
|
||||||
|
|
||||||
mapi := NewMinerAPI(ps, &wrappedSA{sa}, 10)
|
mapi := NewMinerAPI(ps, &wrappedSA{sa}, 10)
|
||||||
dagst, w, err := NewDAGStore(cfg, mapi)
|
|
||||||
h, err := mocknet.New(ctx).GenPeer()
|
h, err := mocknet.New(ctx).GenPeer()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
mapi := NewMinerAPI(ps, sa, 10)
|
|
||||||
dagst, w, err := NewDAGStore(cfg, mapi, h)
|
dagst, w, err := NewDAGStore(cfg, mapi, h)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NotNil(t, dagst)
|
require.NotNil(t, dagst)
|
||||||
|
Loading…
Reference in New Issue
Block a user