Skip to content

Commit

Permalink
fix: cleanup test & handle identity roots
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Sep 1, 2022
1 parent 9f8e513 commit 5ec6921
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
6 changes: 6 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ replace github.com/filecoin-project/filecoin-ffi => ./extern/filecoin-ffi

// replace github.com/filecoin-project/lotus => ../lotus

// replace github.com/filecoin-project/go-fil-markets => ../go-fil-markets

// replace github.com/filecoin-project/dagstore => ../dagstore

// replace github.com/ipld/go-car/v2 => ../../ipld/go-car/v2

require (
contrib.go.opencensus.io/exporter/prometheus v0.4.0
github.com/BurntSushi/toml v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions itests/dummydeal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ func TestDummydealOnline(t *testing.T) {
err = f.WaitForDealAddedToSector(passingDealUuid)
require.NoError(t, err)

outCar := f.RetrieveDirect(ctx, t, rootCid, &res.DealParams.ClientDealProposal.Proposal.PieceCID, true)
kit.AssertFilesEqual(t, carFilepath, outCar)
outFile := f.RetrieveDirect(ctx, t, rootCid, &res.DealParams.ClientDealProposal.Proposal.PieceCID, true)
kit.AssertFilesEqual(t, randomFilepath, outFile)
}
14 changes: 12 additions & 2 deletions itests/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import (
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
"github.com/filecoin-project/specs-actors/v8/actors/builtin"
"github.com/google/uuid"
blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
files "github.com/ipfs/go-ipfs-files"
Expand All @@ -59,6 +60,7 @@ import (
"github.com/ipld/go-car"
"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p-core/host"
"github.com/multiformats/go-multihash"
"github.com/stretchr/testify/require"
"golang.org/x/sync/errgroup"
)
Expand Down Expand Up @@ -682,8 +684,16 @@ func (f *TestFramework) ExtractFileFromCAR(ctx context.Context, t *testing.T, fi
ch, err := car.LoadCar(ctx, bserv.Blockstore(), file)
require.NoError(t, err)

b, err := bserv.GetBlock(ctx, ch.Roots[0])
require.NoError(t, err)
var b blocks.Block
if ch.Roots[0].Prefix().MhType == multihash.IDENTITY {
mh, err := multihash.Decode(ch.Roots[0].Hash())
require.NoError(t, err)
b, err = blocks.NewBlockWithCid(mh.Digest, ch.Roots[0])
require.NoError(t, err)
} else {
b, err = bserv.GetBlock(ctx, ch.Roots[0])
require.NoError(t, err)
}

nd, err := ipld.Decode(b)
require.NoError(t, err)
Expand Down

0 comments on commit 5ec6921

Please sign in to comment.