test the isunsealed api
This commit is contained in:
parent
8cd305338a
commit
ab888c3a07
@ -45,6 +45,8 @@ func TestLotusAccessorFetchUnsealedPiece(t *testing.T) {
|
|||||||
name string
|
name string
|
||||||
deals []abi.SectorNumber
|
deals []abi.SectorNumber
|
||||||
fetchedData string
|
fetchedData string
|
||||||
|
isUnsealed bool
|
||||||
|
|
||||||
expectErr bool
|
expectErr bool
|
||||||
}{{
|
}{{
|
||||||
// Expect error if there is no deal info for piece CID
|
// Expect error if there is no deal info for piece CID
|
||||||
@ -56,11 +58,13 @@ func TestLotusAccessorFetchUnsealedPiece(t *testing.T) {
|
|||||||
name: "prefer unsealed deal",
|
name: "prefer unsealed deal",
|
||||||
deals: []abi.SectorNumber{unsealedSectorID, sealedSectorID},
|
deals: []abi.SectorNumber{unsealedSectorID, sealedSectorID},
|
||||||
fetchedData: unsealedSectorData,
|
fetchedData: unsealedSectorData,
|
||||||
|
isUnsealed: true,
|
||||||
}, {
|
}, {
|
||||||
// Expect the API to unseal the data if there are no unsealed deals
|
// Expect the API to unseal the data if there are no unsealed deals
|
||||||
name: "unseal if necessary",
|
name: "unseal if necessary",
|
||||||
deals: []abi.SectorNumber{sealedSectorID},
|
deals: []abi.SectorNumber{sealedSectorID},
|
||||||
fetchedData: sealedSectorData,
|
fetchedData: sealedSectorData,
|
||||||
|
isUnsealed: false,
|
||||||
}}
|
}}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
@ -95,6 +99,10 @@ func TestLotusAccessorFetchUnsealedPiece(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
require.Equal(t, tc.fetchedData, string(bz))
|
require.Equal(t, tc.fetchedData, string(bz))
|
||||||
|
|
||||||
|
uns, err := api.IsUnsealed(ctx, cid1)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Equal(t, tc.isUnsealed, uns)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user