coreiface: add a testing.T argument to the provider

This is usefull because it allows the Provider to use t.Cleanup for cleaning up the nodes.


This commit was moved from ipfs/boxo@c23df3837f
This commit is contained in:
Jorropo 2023-05-30 19:08:53 +02:00
parent 1b154e2456
commit 18143e2bb3
12 changed files with 91 additions and 91 deletions

View File

@ -13,10 +13,10 @@ var errAPINotImplemented = errors.New("api not implemented")
type Provider interface {
// Make creates n nodes. fullIdentity set to false can be ignored
MakeAPISwarm(ctx context.Context, fullIdentity bool, online bool, n int) ([]coreiface.CoreAPI, error)
MakeAPISwarm(t *testing.T, ctx context.Context, fullIdentity bool, online bool, n int) ([]coreiface.CoreAPI, error)
}
func (tp *TestSuite) makeAPISwarm(ctx context.Context, fullIdentity bool, online bool, n int) ([]coreiface.CoreAPI, error) {
func (tp *TestSuite) makeAPISwarm(t *testing.T, ctx context.Context, fullIdentity bool, online bool, n int) ([]coreiface.CoreAPI, error) {
if tp.apis != nil {
tp.apis <- 1
go func() {
@ -25,11 +25,11 @@ func (tp *TestSuite) makeAPISwarm(ctx context.Context, fullIdentity bool, online
}()
}
return tp.Provider.MakeAPISwarm(ctx, fullIdentity, online, n)
return tp.Provider.MakeAPISwarm(t, ctx, fullIdentity, online, n)
}
func (tp *TestSuite) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) {
api, err := tp.makeAPISwarm(ctx, false, false, 1)
func (tp *TestSuite) makeAPI(t *testing.T, ctx context.Context) (coreiface.CoreAPI, error) {
api, err := tp.makeAPISwarm(t, ctx, false, false, 1)
if err != nil {
return nil, err
}
@ -37,8 +37,8 @@ func (tp *TestSuite) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) {
return api[0], nil
}
func (tp *TestSuite) makeAPIWithIdentityAndOffline(ctx context.Context) (coreiface.CoreAPI, error) {
api, err := tp.makeAPISwarm(ctx, true, false, 1)
func (tp *TestSuite) makeAPIWithIdentityAndOffline(t *testing.T, ctx context.Context) (coreiface.CoreAPI, error) {
api, err := tp.makeAPISwarm(t, ctx, true, false, 1)
if err != nil {
return nil, err
}
@ -46,8 +46,8 @@ func (tp *TestSuite) makeAPIWithIdentityAndOffline(ctx context.Context) (coreifa
return api[0], nil
}
func (tp *TestSuite) MakeAPISwarm(ctx context.Context, n int) ([]coreiface.CoreAPI, error) {
return tp.makeAPISwarm(ctx, true, true, n)
func (tp *TestSuite) MakeAPISwarm(t *testing.T, ctx context.Context, n int) ([]coreiface.CoreAPI, error) {
return tp.makeAPISwarm(t, ctx, true, true, n)
}
type TestSuite struct {
@ -99,7 +99,7 @@ func TestApi(p Provider) func(t *testing.T) {
func (tp *TestSuite) hasApi(t *testing.T, tf func(coreiface.CoreAPI) error) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}

View File

@ -58,7 +58,7 @@ func (tp *TestSuite) TestBlock(t *testing.T) {
func (tp *TestSuite) TestBlockPut(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -78,7 +78,7 @@ func (tp *TestSuite) TestBlockPut(t *testing.T) {
func (tp *TestSuite) TestBlockPutFormatDagCbor(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -98,7 +98,7 @@ func (tp *TestSuite) TestBlockPutFormatDagCbor(t *testing.T) {
func (tp *TestSuite) TestBlockPutFormatDagPb(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -118,7 +118,7 @@ func (tp *TestSuite) TestBlockPutFormatDagPb(t *testing.T) {
func (tp *TestSuite) TestBlockPutFormatV0(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -136,7 +136,7 @@ func (tp *TestSuite) TestBlockPutFormatV0(t *testing.T) {
func (tp *TestSuite) TestBlockPutCidCodecDagCbor(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -154,7 +154,7 @@ func (tp *TestSuite) TestBlockPutCidCodecDagCbor(t *testing.T) {
func (tp *TestSuite) TestBlockPutCidCodecDagPb(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -172,7 +172,7 @@ func (tp *TestSuite) TestBlockPutCidCodecDagPb(t *testing.T) {
func (tp *TestSuite) TestBlockPutHash(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -195,7 +195,7 @@ func (tp *TestSuite) TestBlockPutHash(t *testing.T) {
func (tp *TestSuite) TestBlockGet(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -233,7 +233,7 @@ func (tp *TestSuite) TestBlockGet(t *testing.T) {
func (tp *TestSuite) TestBlockRm(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -287,7 +287,7 @@ func (tp *TestSuite) TestBlockRm(t *testing.T) {
func (tp *TestSuite) TestBlockStat(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -314,7 +314,7 @@ func (tp *TestSuite) TestBlockStat(t *testing.T) {
func (tp *TestSuite) TestBlockPin(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}

View File

@ -44,7 +44,7 @@ var (
func (tp *TestSuite) TestPut(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -67,7 +67,7 @@ func (tp *TestSuite) TestPut(t *testing.T) {
func (tp *TestSuite) TestPutWithHash(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -90,7 +90,7 @@ func (tp *TestSuite) TestPutWithHash(t *testing.T) {
func (tp *TestSuite) TestDagPath(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -135,7 +135,7 @@ func (tp *TestSuite) TestDagPath(t *testing.T) {
func (tp *TestSuite) TestTree(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -170,7 +170,7 @@ func (tp *TestSuite) TestTree(t *testing.T) {
func (tp *TestSuite) TestBatch(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}

View File

@ -26,7 +26,7 @@ func (tp *TestSuite) TestDht(t *testing.T) {
func (tp *TestSuite) TestDhtFindPeer(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
apis, err := tp.MakeAPISwarm(ctx, 5)
apis, err := tp.MakeAPISwarm(t, ctx, 5)
if err != nil {
t.Fatal(err)
}
@ -81,7 +81,7 @@ func (tp *TestSuite) TestDhtFindPeer(t *testing.T) {
func (tp *TestSuite) TestDhtFindProviders(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
apis, err := tp.MakeAPISwarm(ctx, 5)
apis, err := tp.MakeAPISwarm(t, ctx, 5)
if err != nil {
t.Fatal(err)
}
@ -113,7 +113,7 @@ func (tp *TestSuite) TestDhtFindProviders(t *testing.T) {
func (tp *TestSuite) TestDhtProvide(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
apis, err := tp.MakeAPISwarm(ctx, 5)
apis, err := tp.MakeAPISwarm(t, ctx, 5)
if err != nil {
t.Fatal(err)
}

View File

@ -40,7 +40,7 @@ func (tp *TestSuite) TestKey(t *testing.T) {
func (tp *TestSuite) TestListSelf(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
return
@ -74,7 +74,7 @@ func (tp *TestSuite) TestListSelf(t *testing.T) {
func (tp *TestSuite) TestRenameSelf(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
return
@ -102,7 +102,7 @@ func (tp *TestSuite) TestRenameSelf(t *testing.T) {
func (tp *TestSuite) TestRemoveSelf(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
return
@ -121,7 +121,7 @@ func (tp *TestSuite) TestRemoveSelf(t *testing.T) {
func (tp *TestSuite) TestGenerate(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -165,7 +165,7 @@ func verifyIPNSPath(t *testing.T, p string) bool {
func (tp *TestSuite) TestGenerateSize(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -189,7 +189,7 @@ func (tp *TestSuite) TestGenerateType(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -213,7 +213,7 @@ func (tp *TestSuite) TestGenerateType(t *testing.T) {
func (tp *TestSuite) TestGenerateExisting(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -246,7 +246,7 @@ func (tp *TestSuite) TestGenerateExisting(t *testing.T) {
func (tp *TestSuite) TestList(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -285,7 +285,7 @@ func (tp *TestSuite) TestList(t *testing.T) {
func (tp *TestSuite) TestRename(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -314,7 +314,7 @@ func (tp *TestSuite) TestRename(t *testing.T) {
func (tp *TestSuite) TestRenameToSelf(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -338,7 +338,7 @@ func (tp *TestSuite) TestRenameToSelf(t *testing.T) {
func (tp *TestSuite) TestRenameToSelfForce(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -362,7 +362,7 @@ func (tp *TestSuite) TestRenameToSelfForce(t *testing.T) {
func (tp *TestSuite) TestRenameOverwriteNoForce(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -392,7 +392,7 @@ func (tp *TestSuite) TestRenameOverwriteNoForce(t *testing.T) {
func (tp *TestSuite) TestRenameOverwrite(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -431,7 +431,7 @@ func (tp *TestSuite) TestRenameOverwrite(t *testing.T) {
func (tp *TestSuite) TestRenameSameNameNoForce(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -460,7 +460,7 @@ func (tp *TestSuite) TestRenameSameNameNoForce(t *testing.T) {
func (tp *TestSuite) TestRenameSameName(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -489,7 +489,7 @@ func (tp *TestSuite) TestRenameSameName(t *testing.T) {
func (tp *TestSuite) TestRemove(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}

View File

@ -43,7 +43,7 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
init := func() (coreiface.CoreAPI, path.Path) {
apis, err := tp.MakeAPISwarm(ctx, 5)
apis, err := tp.MakeAPISwarm(t, ctx, 5)
if err != nil {
t.Fatal(err)
return nil, nil
@ -191,7 +191,7 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) {
func (tp *TestSuite) TestBasicPublishResolveKey(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
apis, err := tp.MakeAPISwarm(ctx, 5)
apis, err := tp.MakeAPISwarm(t, ctx, 5)
if err != nil {
t.Fatal(err)
}
@ -235,7 +235,7 @@ func (tp *TestSuite) TestBasicPublishResolveTimeout(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
apis, err := tp.MakeAPISwarm(ctx, 5)
apis, err := tp.MakeAPISwarm(t, ctx, 5)
if err != nil {
t.Fatal(err)
}

View File

@ -37,7 +37,7 @@ func (tp *TestSuite) TestObject(t *testing.T) {
func (tp *TestSuite) TestNew(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -64,7 +64,7 @@ func (tp *TestSuite) TestNew(t *testing.T) {
func (tp *TestSuite) TestObjectPut(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -105,7 +105,7 @@ func (tp *TestSuite) TestObjectPut(t *testing.T) {
func (tp *TestSuite) TestObjectGet(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -128,7 +128,7 @@ func (tp *TestSuite) TestObjectGet(t *testing.T) {
func (tp *TestSuite) TestObjectData(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -156,7 +156,7 @@ func (tp *TestSuite) TestObjectData(t *testing.T) {
func (tp *TestSuite) TestObjectLinks(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -192,7 +192,7 @@ func (tp *TestSuite) TestObjectLinks(t *testing.T) {
func (tp *TestSuite) TestObjectStat(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -240,7 +240,7 @@ func (tp *TestSuite) TestObjectStat(t *testing.T) {
func (tp *TestSuite) TestObjectAddLink(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -281,7 +281,7 @@ func (tp *TestSuite) TestObjectAddLink(t *testing.T) {
func (tp *TestSuite) TestObjectAddLinkCreate(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -330,7 +330,7 @@ func (tp *TestSuite) TestObjectAddLinkCreate(t *testing.T) {
func (tp *TestSuite) TestObjectRmLink(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -363,7 +363,7 @@ func (tp *TestSuite) TestObjectRmLink(t *testing.T) {
func (tp *TestSuite) TestObjectAddData(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -396,7 +396,7 @@ func (tp *TestSuite) TestObjectAddData(t *testing.T) {
func (tp *TestSuite) TestObjectSetData(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -429,7 +429,7 @@ func (tp *TestSuite) TestObjectSetData(t *testing.T) {
func (tp *TestSuite) TestDiffTest(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}

View File

@ -25,7 +25,7 @@ func (tp *TestSuite) TestPath(t *testing.T) {
func (tp *TestSuite) TestMutablePath(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -58,7 +58,7 @@ func (tp *TestSuite) TestMutablePath(t *testing.T) {
func (tp *TestSuite) TestPathRemainder(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -89,7 +89,7 @@ func (tp *TestSuite) TestPathRemainder(t *testing.T) {
func (tp *TestSuite) TestEmptyPathRemainder(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -120,7 +120,7 @@ func (tp *TestSuite) TestEmptyPathRemainder(t *testing.T) {
func (tp *TestSuite) TestInvalidPathRemainder(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -147,7 +147,7 @@ func (tp *TestSuite) TestInvalidPathRemainder(t *testing.T) {
func (tp *TestSuite) TestPathRoot(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}

View File

@ -34,7 +34,7 @@ func (tp *TestSuite) TestPin(t *testing.T) {
func (tp *TestSuite) TestPinAdd(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -53,7 +53,7 @@ func (tp *TestSuite) TestPinAdd(t *testing.T) {
func (tp *TestSuite) TestPinSimple(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -105,7 +105,7 @@ func (tp *TestSuite) TestPinSimple(t *testing.T) {
func (tp *TestSuite) TestPinRecursive(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -249,7 +249,7 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) {
func (tp *TestSuite) TestPinLsIndirect(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -282,7 +282,7 @@ func (tp *TestSuite) TestPinLsPrecedence(t *testing.T) {
func (tp *TestSuite) TestPinLsPredenceRecursiveIndirect(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -306,7 +306,7 @@ func (tp *TestSuite) TestPinLsPredenceRecursiveIndirect(t *testing.T) {
func (tp *TestSuite) TestPinLsPrecedenceDirectIndirect(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -330,7 +330,7 @@ func (tp *TestSuite) TestPinLsPrecedenceDirectIndirect(t *testing.T) {
func (tp *TestSuite) TestPinLsPrecedenceRecursiveDirect(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -366,7 +366,7 @@ func (tp *TestSuite) TestPinLsPrecedenceRecursiveDirect(t *testing.T) {
func (tp *TestSuite) TestPinIsPinned(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}

View File

@ -24,7 +24,7 @@ func (tp *TestSuite) TestBasicPubSub(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
apis, err := tp.MakeAPISwarm(ctx, 2)
apis, err := tp.MakeAPISwarm(t, ctx, 2)
if err != nil {
t.Fatal(err)
}

View File

@ -43,7 +43,7 @@ func (tp *TestSuite) TestRoutingGet(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
apis, err := tp.MakeAPISwarm(ctx, 2)
apis, err := tp.MakeAPISwarm(t, ctx, 2)
if err != nil {
t.Fatal(err)
}
@ -72,7 +72,7 @@ func (tp *TestSuite) TestRoutingGet(t *testing.T) {
func (tp *TestSuite) TestRoutingPut(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
apis, err := tp.MakeAPISwarm(ctx, 2)
apis, err := tp.MakeAPISwarm(t, ctx, 2)
if err != nil {
t.Fatal(err)
}
@ -98,7 +98,7 @@ func (tp *TestSuite) TestRoutingPutOffline(t *testing.T) {
defer cancel()
// init a swarm & publish an IPNS entry to get a valid payload
apis, err := tp.MakeAPISwarm(ctx, 2)
apis, err := tp.MakeAPISwarm(t, ctx, 2)
if err != nil {
t.Fatal(err)
}
@ -110,7 +110,7 @@ func (tp *TestSuite) TestRoutingPutOffline(t *testing.T) {
}
// init our offline node and try to put the payload
api, err := tp.makeAPIWithIdentityAndOffline(ctx)
api, err := tp.makeAPIWithIdentityAndOffline(t, ctx)
if err != nil {
t.Fatal(err)
}

View File

@ -99,7 +99,7 @@ func wrapped(names ...string) func(f files.Node) files.Node {
func (tp *TestSuite) TestAdd(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -533,7 +533,7 @@ func (tp *TestSuite) TestAdd(t *testing.T) {
func (tp *TestSuite) TestAddPinned(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -559,7 +559,7 @@ func (tp *TestSuite) TestAddPinned(t *testing.T) {
func (tp *TestSuite) TestAddHashOnly(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -585,7 +585,7 @@ func (tp *TestSuite) TestAddHashOnly(t *testing.T) {
func (tp *TestSuite) TestGetEmptyFile(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -615,7 +615,7 @@ func (tp *TestSuite) TestGetEmptyFile(t *testing.T) {
func (tp *TestSuite) TestGetDir(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -648,7 +648,7 @@ func (tp *TestSuite) TestGetDir(t *testing.T) {
func (tp *TestSuite) TestGetNonUnixfs(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -668,7 +668,7 @@ func (tp *TestSuite) TestGetNonUnixfs(t *testing.T) {
func (tp *TestSuite) TestLs(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -728,7 +728,7 @@ func (tp *TestSuite) TestLs(t *testing.T) {
func (tp *TestSuite) TestEntriesExpired(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -770,7 +770,7 @@ func (tp *TestSuite) TestEntriesExpired(t *testing.T) {
func (tp *TestSuite) TestLsEmptyDir(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -799,7 +799,7 @@ func (tp *TestSuite) TestLsEmptyDir(t *testing.T) {
func (tp *TestSuite) TestLsNonUnixfs(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -858,7 +858,7 @@ func (f *closeTestF) Close() error {
func (tp *TestSuite) TestAddCloses(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -896,7 +896,7 @@ func (tp *TestSuite) TestAddCloses(t *testing.T) {
func (tp *TestSuite) TestGetSeek(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}
@ -1002,7 +1002,7 @@ func (tp *TestSuite) TestGetSeek(t *testing.T) {
func (tp *TestSuite) TestGetReadAt(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
api, err := tp.makeAPI(t, ctx)
if err != nil {
t.Fatal(err)
}