From 6fe8577a835a24bf8a38de0d5ee9d1fe6ca9e913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 17 May 2019 18:57:15 +0200 Subject: [PATCH] tests: expose TestSuite --- tests/api.go | 22 ++++++++++++---------- tests/block.go | 16 ++++++++-------- tests/dag.go | 12 ++++++------ tests/dht.go | 8 ++++---- tests/key.go | 34 +++++++++++++++++----------------- tests/name.go | 8 ++++---- tests/object.go | 26 +++++++++++++------------- tests/path.go | 14 +++++++------- tests/pin.go | 8 ++++---- tests/pubsub.go | 4 ++-- tests/unixfs.go | 26 +++++++++++++------------- 11 files changed, 90 insertions(+), 88 deletions(-) diff --git a/tests/api.go b/tests/api.go index 5e7c1f5..1af3a83 100644 --- a/tests/api.go +++ b/tests/api.go @@ -11,7 +11,7 @@ import ( var apiNotImplemented = errors.New("api not implemented") -func (tp *provider) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { +func (tp *TestSuite) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { api, err := tp.MakeAPISwarm(ctx, false, 1) if err != nil { return nil, err @@ -25,17 +25,19 @@ type Provider interface { MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) } -func (tp *provider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) { - tp.apis <- 1 - go func() { - <-ctx.Done() - tp.apis <- -1 - }() +func (tp *TestSuite) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) { + if tp.apis != nil { + tp.apis <- 1 + go func() { + <-ctx.Done() + tp.apis <- -1 + }() + } return tp.Provider.MakeAPISwarm(ctx, fullIdentity, n) } -type provider struct { +type TestSuite struct { Provider apis chan int @@ -55,7 +57,7 @@ func TestApi(p Provider) func(t *testing.T) { } }() - tp := &provider{Provider: p, apis: apis} + tp := &TestSuite{Provider: p, apis: apis} return func(t *testing.T) { t.Run("Block", tp.TestBlock) @@ -80,7 +82,7 @@ func TestApi(p Provider) func(t *testing.T) { } } -func (tp *provider) hasApi(t *testing.T, tf func(coreiface.CoreAPI) error) { +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) diff --git a/tests/block.go b/tests/block.go index 34e47e9..6b648f3 100644 --- a/tests/block.go +++ b/tests/block.go @@ -13,7 +13,7 @@ import ( mh "github.com/multiformats/go-multihash" ) -func (tp *provider) TestBlock(t *testing.T) { +func (tp *TestSuite) TestBlock(t *testing.T) { tp.hasApi(t, func(api coreiface.CoreAPI) error { if api.Block() == nil { return apiNotImplemented @@ -30,7 +30,7 @@ func (tp *provider) TestBlock(t *testing.T) { t.Run("TestBlockPin", tp.TestBlockPin) } -func (tp *provider) TestBlockPut(t *testing.T) { +func (tp *TestSuite) TestBlockPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -48,7 +48,7 @@ func (tp *provider) TestBlockPut(t *testing.T) { } } -func (tp *provider) TestBlockPutFormat(t *testing.T) { +func (tp *TestSuite) TestBlockPutFormat(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -66,7 +66,7 @@ func (tp *provider) TestBlockPutFormat(t *testing.T) { } } -func (tp *provider) TestBlockPutHash(t *testing.T) { +func (tp *TestSuite) TestBlockPutHash(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -84,7 +84,7 @@ func (tp *provider) TestBlockPutHash(t *testing.T) { } } -func (tp *provider) TestBlockGet(t *testing.T) { +func (tp *TestSuite) TestBlockGet(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -122,7 +122,7 @@ func (tp *provider) TestBlockGet(t *testing.T) { } } -func (tp *provider) TestBlockRm(t *testing.T) { +func (tp *TestSuite) TestBlockRm(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -176,7 +176,7 @@ func (tp *provider) TestBlockRm(t *testing.T) { } } -func (tp *provider) TestBlockStat(t *testing.T) { +func (tp *TestSuite) TestBlockStat(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -203,7 +203,7 @@ func (tp *provider) TestBlockStat(t *testing.T) { } } -func (tp *provider) TestBlockPin(t *testing.T) { +func (tp *TestSuite) TestBlockPin(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) diff --git a/tests/dag.go b/tests/dag.go index 0bb3aa4..1ccd45d 100644 --- a/tests/dag.go +++ b/tests/dag.go @@ -15,7 +15,7 @@ import ( mh "github.com/multiformats/go-multihash" ) -func (tp *provider) TestDag(t *testing.T) { +func (tp *TestSuite) TestDag(t *testing.T) { tp.hasApi(t, func(api coreiface.CoreAPI) error { if api.Dag() == nil { return apiNotImplemented @@ -40,7 +40,7 @@ var ( } ) -func (tp *provider) TestPut(t *testing.T) { +func (tp *TestSuite) TestPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -63,7 +63,7 @@ func (tp *provider) TestPut(t *testing.T) { } } -func (tp *provider) TestPutWithHash(t *testing.T) { +func (tp *TestSuite) TestPutWithHash(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -86,7 +86,7 @@ func (tp *provider) TestPutWithHash(t *testing.T) { } } -func (tp *provider) TestDagPath(t *testing.T) { +func (tp *TestSuite) TestDagPath(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -131,7 +131,7 @@ func (tp *provider) TestDagPath(t *testing.T) { } } -func (tp *provider) TestTree(t *testing.T) { +func (tp *TestSuite) TestTree(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -166,7 +166,7 @@ func (tp *provider) TestTree(t *testing.T) { } } -func (tp *provider) TestBatch(t *testing.T) { +func (tp *TestSuite) TestBatch(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) diff --git a/tests/dht.go b/tests/dht.go index 5482b50..33b4ff1 100644 --- a/tests/dht.go +++ b/tests/dht.go @@ -9,7 +9,7 @@ import ( "github.com/ipfs/interface-go-ipfs-core/options" ) -func (tp *provider) TestDht(t *testing.T) { +func (tp *TestSuite) TestDht(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.Dht() == nil { return apiNotImplemented @@ -22,7 +22,7 @@ func (tp *provider) TestDht(t *testing.T) { t.Run("TestDhtProvide", tp.TestDhtProvide) } -func (tp *provider) TestDhtFindPeer(t *testing.T) { +func (tp *TestSuite) TestDhtFindPeer(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() apis, err := tp.MakeAPISwarm(ctx, true, 5) @@ -75,7 +75,7 @@ func (tp *provider) TestDhtFindPeer(t *testing.T) { } } -func (tp *provider) TestDhtFindProviders(t *testing.T) { +func (tp *TestSuite) TestDhtFindProviders(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() apis, err := tp.MakeAPISwarm(ctx, true, 5) @@ -105,7 +105,7 @@ func (tp *provider) TestDhtFindProviders(t *testing.T) { } } -func (tp *provider) TestDhtProvide(t *testing.T) { +func (tp *TestSuite) TestDhtProvide(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() apis, err := tp.MakeAPISwarm(ctx, true, 5) diff --git a/tests/key.go b/tests/key.go index 7ff5f33..e3461f9 100644 --- a/tests/key.go +++ b/tests/key.go @@ -9,7 +9,7 @@ import ( opt "github.com/ipfs/interface-go-ipfs-core/options" ) -func (tp *provider) TestKey(t *testing.T) { +func (tp *TestSuite) TestKey(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.Key() == nil { return apiNotImplemented @@ -35,7 +35,7 @@ func (tp *provider) TestKey(t *testing.T) { t.Run("TestRemove", tp.TestRemove) } -func (tp *provider) TestListSelf(t *testing.T) { +func (tp *TestSuite) TestListSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -69,7 +69,7 @@ func (tp *provider) TestListSelf(t *testing.T) { } } -func (tp *provider) TestRenameSelf(t *testing.T) { +func (tp *TestSuite) TestRenameSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -97,7 +97,7 @@ func (tp *provider) TestRenameSelf(t *testing.T) { } } -func (tp *provider) TestRemoveSelf(t *testing.T) { +func (tp *TestSuite) TestRemoveSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -116,7 +116,7 @@ func (tp *provider) TestRemoveSelf(t *testing.T) { } } -func (tp *provider) TestGenerate(t *testing.T) { +func (tp *TestSuite) TestGenerate(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -139,7 +139,7 @@ func (tp *provider) TestGenerate(t *testing.T) { } } -func (tp *provider) TestGenerateSize(t *testing.T) { +func (tp *TestSuite) TestGenerateSize(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -162,7 +162,7 @@ func (tp *provider) TestGenerateSize(t *testing.T) { } } -func (tp *provider) TestGenerateType(t *testing.T) { +func (tp *TestSuite) TestGenerateType(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() t.Skip("disabled until libp2p/specs#111 is fixed") @@ -188,7 +188,7 @@ func (tp *provider) TestGenerateType(t *testing.T) { } } -func (tp *provider) TestGenerateExisting(t *testing.T) { +func (tp *TestSuite) TestGenerateExisting(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -221,7 +221,7 @@ func (tp *provider) TestGenerateExisting(t *testing.T) { } } -func (tp *provider) TestList(t *testing.T) { +func (tp *TestSuite) TestList(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -267,7 +267,7 @@ func (tp *provider) TestList(t *testing.T) { } } -func (tp *provider) TestRename(t *testing.T) { +func (tp *TestSuite) TestRename(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -296,7 +296,7 @@ func (tp *provider) TestRename(t *testing.T) { } } -func (tp *provider) TestRenameToSelf(t *testing.T) { +func (tp *TestSuite) TestRenameToSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -320,7 +320,7 @@ func (tp *provider) TestRenameToSelf(t *testing.T) { } } -func (tp *provider) TestRenameToSelfForce(t *testing.T) { +func (tp *TestSuite) TestRenameToSelfForce(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -344,7 +344,7 @@ func (tp *provider) TestRenameToSelfForce(t *testing.T) { } } -func (tp *provider) TestRenameOverwriteNoForce(t *testing.T) { +func (tp *TestSuite) TestRenameOverwriteNoForce(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -374,7 +374,7 @@ func (tp *provider) TestRenameOverwriteNoForce(t *testing.T) { } } -func (tp *provider) TestRenameOverwrite(t *testing.T) { +func (tp *TestSuite) TestRenameOverwrite(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -413,7 +413,7 @@ func (tp *provider) TestRenameOverwrite(t *testing.T) { } } -func (tp *provider) TestRenameSameNameNoForce(t *testing.T) { +func (tp *TestSuite) TestRenameSameNameNoForce(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -442,7 +442,7 @@ func (tp *provider) TestRenameSameNameNoForce(t *testing.T) { } } -func (tp *provider) TestRenameSameName(t *testing.T) { +func (tp *TestSuite) TestRenameSameName(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -471,7 +471,7 @@ func (tp *provider) TestRenameSameName(t *testing.T) { } } -func (tp *provider) TestRemove(t *testing.T) { +func (tp *TestSuite) TestRemove(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) diff --git a/tests/name.go b/tests/name.go index efaf1d3..31a5c14 100644 --- a/tests/name.go +++ b/tests/name.go @@ -16,7 +16,7 @@ import ( opt "github.com/ipfs/interface-go-ipfs-core/options" ) -func (tp *provider) TestName(t *testing.T) { +func (tp *TestSuite) TestName(t *testing.T) { tp.hasApi(t, func(api coreiface.CoreAPI) error { if api.Name() == nil { return apiNotImplemented @@ -39,7 +39,7 @@ func appendPath(p path.Path, sub string) path.Path { return path.New(gopath.Join(p.String(), sub)) } -func (tp *provider) TestPublishResolve(t *testing.T) { +func (tp *TestSuite) TestPublishResolve(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() init := func() (coreiface.CoreAPI, path.Path) { @@ -188,7 +188,7 @@ func (tp *provider) TestPublishResolve(t *testing.T) { }) } -func (tp *provider) TestBasicPublishResolveKey(t *testing.T) { +func (tp *TestSuite) TestBasicPublishResolveKey(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() apis, err := tp.MakeAPISwarm(ctx, true, 5) @@ -230,7 +230,7 @@ func (tp *provider) TestBasicPublishResolveKey(t *testing.T) { } } -func (tp *provider) TestBasicPublishResolveTimeout(t *testing.T) { +func (tp *TestSuite) TestBasicPublishResolveTimeout(t *testing.T) { t.Skip("ValidTime doesn't appear to work at this time resolution") ctx, cancel := context.WithCancel(context.Background()) diff --git a/tests/object.go b/tests/object.go index 8682a2e..2e066ca 100644 --- a/tests/object.go +++ b/tests/object.go @@ -12,7 +12,7 @@ import ( opt "github.com/ipfs/interface-go-ipfs-core/options" ) -func (tp *provider) TestObject(t *testing.T) { +func (tp *TestSuite) TestObject(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.Object() == nil { return apiNotImplemented @@ -34,7 +34,7 @@ func (tp *provider) TestObject(t *testing.T) { t.Run("TestDiffTest", tp.TestDiffTest) } -func (tp *provider) TestNew(t *testing.T) { +func (tp *TestSuite) TestNew(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -61,7 +61,7 @@ func (tp *provider) TestNew(t *testing.T) { } } -func (tp *provider) TestObjectPut(t *testing.T) { +func (tp *TestSuite) TestObjectPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -102,7 +102,7 @@ func (tp *provider) TestObjectPut(t *testing.T) { } } -func (tp *provider) TestObjectGet(t *testing.T) { +func (tp *TestSuite) TestObjectGet(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -125,7 +125,7 @@ func (tp *provider) TestObjectGet(t *testing.T) { } } -func (tp *provider) TestObjectData(t *testing.T) { +func (tp *TestSuite) TestObjectData(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -153,7 +153,7 @@ func (tp *provider) TestObjectData(t *testing.T) { } } -func (tp *provider) TestObjectLinks(t *testing.T) { +func (tp *TestSuite) TestObjectLinks(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -189,7 +189,7 @@ func (tp *provider) TestObjectLinks(t *testing.T) { } } -func (tp *provider) TestObjectStat(t *testing.T) { +func (tp *TestSuite) TestObjectStat(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -237,7 +237,7 @@ func (tp *provider) TestObjectStat(t *testing.T) { } } -func (tp *provider) TestObjectAddLink(t *testing.T) { +func (tp *TestSuite) TestObjectAddLink(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -278,7 +278,7 @@ func (tp *provider) TestObjectAddLink(t *testing.T) { } } -func (tp *provider) TestObjectAddLinkCreate(t *testing.T) { +func (tp *TestSuite) TestObjectAddLinkCreate(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -327,7 +327,7 @@ func (tp *provider) TestObjectAddLinkCreate(t *testing.T) { } } -func (tp *provider) TestObjectRmLink(t *testing.T) { +func (tp *TestSuite) TestObjectRmLink(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -360,7 +360,7 @@ func (tp *provider) TestObjectRmLink(t *testing.T) { } } -func (tp *provider) TestObjectAddData(t *testing.T) { +func (tp *TestSuite) TestObjectAddData(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -393,7 +393,7 @@ func (tp *provider) TestObjectAddData(t *testing.T) { } } -func (tp *provider) TestObjectSetData(t *testing.T) { +func (tp *TestSuite) TestObjectSetData(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -426,7 +426,7 @@ func (tp *provider) TestObjectSetData(t *testing.T) { } } -func (tp *provider) TestDiffTest(t *testing.T) { +func (tp *TestSuite) TestDiffTest(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) diff --git a/tests/path.go b/tests/path.go index 4fd18bd..2d94972 100644 --- a/tests/path.go +++ b/tests/path.go @@ -12,7 +12,7 @@ import ( ipldcbor "github.com/ipfs/go-ipld-cbor" ) -func (tp *provider) TestPath(t *testing.T) { +func (tp *TestSuite) TestPath(t *testing.T) { t.Run("TestMutablePath", tp.TestMutablePath) t.Run("TestPathRemainder", tp.TestPathRemainder) t.Run("TestEmptyPathRemainder", tp.TestEmptyPathRemainder) @@ -21,7 +21,7 @@ func (tp *provider) TestPath(t *testing.T) { t.Run("TestPathJoin", tp.TestPathJoin) } -func (tp *provider) TestMutablePath(t *testing.T) { +func (tp *TestSuite) TestMutablePath(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -54,7 +54,7 @@ func (tp *provider) TestMutablePath(t *testing.T) { } } -func (tp *provider) TestPathRemainder(t *testing.T) { +func (tp *TestSuite) TestPathRemainder(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -85,7 +85,7 @@ func (tp *provider) TestPathRemainder(t *testing.T) { } } -func (tp *provider) TestEmptyPathRemainder(t *testing.T) { +func (tp *TestSuite) TestEmptyPathRemainder(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -116,7 +116,7 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) { } } -func (tp *provider) TestInvalidPathRemainder(t *testing.T) { +func (tp *TestSuite) TestInvalidPathRemainder(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -143,7 +143,7 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) { } } -func (tp *provider) TestPathRoot(t *testing.T) { +func (tp *TestSuite) TestPathRoot(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -187,7 +187,7 @@ func (tp *provider) TestPathRoot(t *testing.T) { } } -func (tp *provider) TestPathJoin(t *testing.T) { +func (tp *TestSuite) TestPathJoin(t *testing.T) { p1 := path.New("/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz") if path.Join(p1, "foo").String() != "/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz/foo" { diff --git a/tests/pin.go b/tests/pin.go index 344db65..9b28a68 100644 --- a/tests/pin.go +++ b/tests/pin.go @@ -14,7 +14,7 @@ import ( ipld "github.com/ipfs/go-ipld-format" ) -func (tp *provider) TestPin(t *testing.T) { +func (tp *TestSuite) TestPin(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.Pin() == nil { return apiNotImplemented @@ -27,7 +27,7 @@ func (tp *provider) TestPin(t *testing.T) { t.Run("TestPinRecursive", tp.TestPinRecursive) } -func (tp *provider) TestPinAdd(t *testing.T) { +func (tp *TestSuite) TestPinAdd(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -46,7 +46,7 @@ func (tp *provider) TestPinAdd(t *testing.T) { } } -func (tp *provider) TestPinSimple(t *testing.T) { +func (tp *TestSuite) TestPinSimple(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -96,7 +96,7 @@ func (tp *provider) TestPinSimple(t *testing.T) { } } -func (tp *provider) TestPinRecursive(t *testing.T) { +func (tp *TestSuite) TestPinRecursive(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) diff --git a/tests/pubsub.go b/tests/pubsub.go index 418fc48..e662915 100644 --- a/tests/pubsub.go +++ b/tests/pubsub.go @@ -9,7 +9,7 @@ import ( "github.com/ipfs/interface-go-ipfs-core/options" ) -func (tp *provider) TestPubSub(t *testing.T) { +func (tp *TestSuite) TestPubSub(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.PubSub() == nil { return apiNotImplemented @@ -20,7 +20,7 @@ func (tp *provider) TestPubSub(t *testing.T) { t.Run("TestBasicPubSub", tp.TestBasicPubSub) } -func (tp *provider) TestBasicPubSub(t *testing.T) { +func (tp *TestSuite) TestBasicPubSub(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() diff --git a/tests/unixfs.go b/tests/unixfs.go index c810167..47ce505 100644 --- a/tests/unixfs.go +++ b/tests/unixfs.go @@ -28,7 +28,7 @@ import ( mh "github.com/multiformats/go-multihash" ) -func (tp *provider) TestUnixfs(t *testing.T) { +func (tp *TestSuite) TestUnixfs(t *testing.T) { tp.hasApi(t, func(api coreiface.CoreAPI) error { if api.Unixfs() == nil { return apiNotImplemented @@ -94,7 +94,7 @@ func wrapped(names ...string) func(f files.Node) files.Node { } } -func (tp *provider) TestAdd(t *testing.T) { +func (tp *TestSuite) TestAdd(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -528,7 +528,7 @@ func (tp *provider) TestAdd(t *testing.T) { } } -func (tp *provider) TestAddPinned(t *testing.T) { +func (tp *TestSuite) TestAddPinned(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -554,7 +554,7 @@ func (tp *provider) TestAddPinned(t *testing.T) { } } -func (tp *provider) TestAddHashOnly(t *testing.T) { +func (tp *TestSuite) TestAddHashOnly(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -580,7 +580,7 @@ func (tp *provider) TestAddHashOnly(t *testing.T) { } } -func (tp *provider) TestGetEmptyFile(t *testing.T) { +func (tp *TestSuite) TestGetEmptyFile(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -610,7 +610,7 @@ func (tp *provider) TestGetEmptyFile(t *testing.T) { } } -func (tp *provider) TestGetDir(t *testing.T) { +func (tp *TestSuite) TestGetDir(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -643,7 +643,7 @@ func (tp *provider) TestGetDir(t *testing.T) { } } -func (tp *provider) TestGetNonUnixfs(t *testing.T) { +func (tp *TestSuite) TestGetNonUnixfs(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -663,7 +663,7 @@ func (tp *provider) TestGetNonUnixfs(t *testing.T) { } } -func (tp *provider) TestLs(t *testing.T) { +func (tp *TestSuite) TestLs(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -723,7 +723,7 @@ func (tp *provider) TestLs(t *testing.T) { } } -func (tp *provider) TestEntriesExpired(t *testing.T) { +func (tp *TestSuite) TestEntriesExpired(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -765,7 +765,7 @@ func (tp *provider) TestEntriesExpired(t *testing.T) { } } -func (tp *provider) TestLsEmptyDir(t *testing.T) { +func (tp *TestSuite) TestLsEmptyDir(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -794,7 +794,7 @@ func (tp *provider) TestLsEmptyDir(t *testing.T) { } // TODO(lgierth) this should test properly, with len(links) > 0 -func (tp *provider) TestLsNonUnixfs(t *testing.T) { +func (tp *TestSuite) TestLsNonUnixfs(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -853,7 +853,7 @@ func (f *closeTestF) Close() error { return nil } -func (tp *provider) TestAddCloses(t *testing.T) { +func (tp *TestSuite) TestAddCloses(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -891,7 +891,7 @@ func (tp *provider) TestAddCloses(t *testing.T) { } } -func (tp *provider) TestGetSeek(t *testing.T) { +func (tp *TestSuite) TestGetSeek(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx)