tests: expose TestSuite
This commit was moved from ipfs/interface-go-ipfs-core@6fe8577a835a24bf8a38de0d5ee9d1fe6ca9e913 This commit was moved from ipfs/boxo@3d72707f576f881c01bc5fc9ffb97ece3456c014
Łukasz Magiera committed
May 17, 2019 at 18:57 UTC
79958dc097b5b6399e4b4e0af859e711d0f6726e
11 files changed
+90
-88
core/coreiface/tests/api.go
+12
-10
@@ -11,7 +11,7 @@ import (
11
12
var apiNotImplemented = errors.New("api not implemented")
13
14
-func (tp *provider) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) {
14
+func (tp *TestSuite) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) {
15
api, err := tp.MakeAPISwarm(ctx, false, 1)
16
if err != nil {
17
return nil, err
@@ -25,17 +25,19 @@ type Provider interface {
25
MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error)
26
}
27
28
-func (tp *provider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) {
29
- tp.apis <- 1
30
- go func() {
31
- <-ctx.Done()
32
- tp.apis <- -1
33
- }()
28
+func (tp *TestSuite) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) {
29
+ if tp.apis != nil {
30
+ tp.apis <- 1
31
+ go func() {
32
+ <-ctx.Done()
33
+ tp.apis <- -1
34
+ }()
35
+ }
36
37
return tp.Provider.MakeAPISwarm(ctx, fullIdentity, n)
38
}
39
38
-type provider struct {
40
+type TestSuite struct {
41
Provider
42
43
apis chan int
@@ -55,7 +57,7 @@ func TestApi(p Provider) func(t *testing.T) {
57
}
58
}()
59
58
- tp := &provider{Provider: p, apis: apis}
60
+ tp := &TestSuite{Provider: p, apis: apis}
61
62
return func(t *testing.T) {
63
t.Run("Block", tp.TestBlock)
@@ -80,7 +82,7 @@ func TestApi(p Provider) func(t *testing.T) {
82
}
83
}
84
83
-func (tp *provider) hasApi(t *testing.T, tf func(coreiface.CoreAPI) error) {
85
+func (tp *TestSuite) hasApi(t *testing.T, tf func(coreiface.CoreAPI) error) {
86
ctx, cancel := context.WithCancel(context.Background())
87
defer cancel()
88
api, err := tp.makeAPI(ctx)
core/coreiface/tests/block.go
+8
-8
@@ -13,7 +13,7 @@ import (
13
mh "github.com/multiformats/go-multihash"
14
)
15
16
-func (tp *provider) TestBlock(t *testing.T) {
16
+func (tp *TestSuite) TestBlock(t *testing.T) {
17
tp.hasApi(t, func(api coreiface.CoreAPI) error {
18
if api.Block() == nil {
19
return apiNotImplemented
@@ -30,7 +30,7 @@ func (tp *provider) TestBlock(t *testing.T) {
30
t.Run("TestBlockPin", tp.TestBlockPin)
31
}
32
33
-func (tp *provider) TestBlockPut(t *testing.T) {
33
+func (tp *TestSuite) TestBlockPut(t *testing.T) {
34
ctx, cancel := context.WithCancel(context.Background())
35
defer cancel()
36
api, err := tp.makeAPI(ctx)
@@ -48,7 +48,7 @@ func (tp *provider) TestBlockPut(t *testing.T) {
48
}
49
}
50
51
-func (tp *provider) TestBlockPutFormat(t *testing.T) {
51
+func (tp *TestSuite) TestBlockPutFormat(t *testing.T) {
52
ctx, cancel := context.WithCancel(context.Background())
53
defer cancel()
54
api, err := tp.makeAPI(ctx)
@@ -66,7 +66,7 @@ func (tp *provider) TestBlockPutFormat(t *testing.T) {
66
}
67
}
68
69
-func (tp *provider) TestBlockPutHash(t *testing.T) {
69
+func (tp *TestSuite) TestBlockPutHash(t *testing.T) {
70
ctx, cancel := context.WithCancel(context.Background())
71
defer cancel()
72
api, err := tp.makeAPI(ctx)
@@ -84,7 +84,7 @@ func (tp *provider) TestBlockPutHash(t *testing.T) {
84
}
85
}
86
87
-func (tp *provider) TestBlockGet(t *testing.T) {
87
+func (tp *TestSuite) TestBlockGet(t *testing.T) {
88
ctx, cancel := context.WithCancel(context.Background())
89
defer cancel()
90
api, err := tp.makeAPI(ctx)
@@ -122,7 +122,7 @@ func (tp *provider) TestBlockGet(t *testing.T) {
122
}
123
}
124
125
-func (tp *provider) TestBlockRm(t *testing.T) {
125
+func (tp *TestSuite) TestBlockRm(t *testing.T) {
126
ctx, cancel := context.WithCancel(context.Background())
127
defer cancel()
128
api, err := tp.makeAPI(ctx)
@@ -176,7 +176,7 @@ func (tp *provider) TestBlockRm(t *testing.T) {
176
}
177
}
178
179
-func (tp *provider) TestBlockStat(t *testing.T) {
179
+func (tp *TestSuite) TestBlockStat(t *testing.T) {
180
ctx, cancel := context.WithCancel(context.Background())
181
defer cancel()
182
api, err := tp.makeAPI(ctx)
@@ -203,7 +203,7 @@ func (tp *provider) TestBlockStat(t *testing.T) {
203
}
204
}
205
206
-func (tp *provider) TestBlockPin(t *testing.T) {
206
+func (tp *TestSuite) TestBlockPin(t *testing.T) {
207
ctx, cancel := context.WithCancel(context.Background())
208
defer cancel()
209
api, err := tp.makeAPI(ctx)
core/coreiface/tests/dag.go
+6
-6
@@ -15,7 +15,7 @@ import (
15
mh "github.com/multiformats/go-multihash"
16
)
17
18
-func (tp *provider) TestDag(t *testing.T) {
18
+func (tp *TestSuite) TestDag(t *testing.T) {
19
tp.hasApi(t, func(api coreiface.CoreAPI) error {
20
if api.Dag() == nil {
21
return apiNotImplemented
@@ -40,7 +40,7 @@ var (
40
}
41
)
42
43
-func (tp *provider) TestPut(t *testing.T) {
43
+func (tp *TestSuite) TestPut(t *testing.T) {
44
ctx, cancel := context.WithCancel(context.Background())
45
defer cancel()
46
api, err := tp.makeAPI(ctx)
@@ -63,7 +63,7 @@ func (tp *provider) TestPut(t *testing.T) {
63
}
64
}
65
66
-func (tp *provider) TestPutWithHash(t *testing.T) {
66
+func (tp *TestSuite) TestPutWithHash(t *testing.T) {
67
ctx, cancel := context.WithCancel(context.Background())
68
defer cancel()
69
api, err := tp.makeAPI(ctx)
@@ -86,7 +86,7 @@ func (tp *provider) TestPutWithHash(t *testing.T) {
86
}
87
}
88
89
-func (tp *provider) TestDagPath(t *testing.T) {
89
+func (tp *TestSuite) TestDagPath(t *testing.T) {
90
ctx, cancel := context.WithCancel(context.Background())
91
defer cancel()
92
api, err := tp.makeAPI(ctx)
@@ -131,7 +131,7 @@ func (tp *provider) TestDagPath(t *testing.T) {
131
}
132
}
133
134
-func (tp *provider) TestTree(t *testing.T) {
134
+func (tp *TestSuite) TestTree(t *testing.T) {
135
ctx, cancel := context.WithCancel(context.Background())
136
defer cancel()
137
api, err := tp.makeAPI(ctx)
@@ -166,7 +166,7 @@ func (tp *provider) TestTree(t *testing.T) {
166
}
167
}
168
169
-func (tp *provider) TestBatch(t *testing.T) {
169
+func (tp *TestSuite) TestBatch(t *testing.T) {
170
ctx, cancel := context.WithCancel(context.Background())
171
defer cancel()
172
api, err := tp.makeAPI(ctx)
core/coreiface/tests/dht.go
+4
-4
@@ -9,7 +9,7 @@ import (
9
"github.com/ipfs/interface-go-ipfs-core/options"
10
)
11
12
-func (tp *provider) TestDht(t *testing.T) {
12
+func (tp *TestSuite) TestDht(t *testing.T) {
13
tp.hasApi(t, func(api iface.CoreAPI) error {
14
if api.Dht() == nil {
15
return apiNotImplemented
@@ -22,7 +22,7 @@ func (tp *provider) TestDht(t *testing.T) {
22
t.Run("TestDhtProvide", tp.TestDhtProvide)
23
}
24
25
-func (tp *provider) TestDhtFindPeer(t *testing.T) {
25
+func (tp *TestSuite) TestDhtFindPeer(t *testing.T) {
26
ctx, cancel := context.WithCancel(context.Background())
27
defer cancel()
28
apis, err := tp.MakeAPISwarm(ctx, true, 5)
@@ -75,7 +75,7 @@ func (tp *provider) TestDhtFindPeer(t *testing.T) {
75
}
76
}
77
78
-func (tp *provider) TestDhtFindProviders(t *testing.T) {
78
+func (tp *TestSuite) TestDhtFindProviders(t *testing.T) {
79
ctx, cancel := context.WithCancel(context.Background())
80
defer cancel()
81
apis, err := tp.MakeAPISwarm(ctx, true, 5)
@@ -105,7 +105,7 @@ func (tp *provider) TestDhtFindProviders(t *testing.T) {
105
}
106
}
107
108
-func (tp *provider) TestDhtProvide(t *testing.T) {
108
+func (tp *TestSuite) TestDhtProvide(t *testing.T) {
109
ctx, cancel := context.WithCancel(context.Background())
110
defer cancel()
111
apis, err := tp.MakeAPISwarm(ctx, true, 5)
core/coreiface/tests/key.go
+17
-17
@@ -9,7 +9,7 @@ import (
9
opt "github.com/ipfs/interface-go-ipfs-core/options"
10
)
11
12
-func (tp *provider) TestKey(t *testing.T) {
12
+func (tp *TestSuite) TestKey(t *testing.T) {
13
tp.hasApi(t, func(api iface.CoreAPI) error {
14
if api.Key() == nil {
15
return apiNotImplemented
@@ -35,7 +35,7 @@ func (tp *provider) TestKey(t *testing.T) {
35
t.Run("TestRemove", tp.TestRemove)
36
}
37
38
-func (tp *provider) TestListSelf(t *testing.T) {
38
+func (tp *TestSuite) TestListSelf(t *testing.T) {
39
ctx, cancel := context.WithCancel(context.Background())
40
defer cancel()
41
api, err := tp.makeAPI(ctx)
@@ -69,7 +69,7 @@ func (tp *provider) TestListSelf(t *testing.T) {
69
}
70
}
71
72
-func (tp *provider) TestRenameSelf(t *testing.T) {
72
+func (tp *TestSuite) TestRenameSelf(t *testing.T) {
73
ctx, cancel := context.WithCancel(context.Background())
74
defer cancel()
75
api, err := tp.makeAPI(ctx)
@@ -97,7 +97,7 @@ func (tp *provider) TestRenameSelf(t *testing.T) {
97
}
98
}
99
100
-func (tp *provider) TestRemoveSelf(t *testing.T) {
100
+func (tp *TestSuite) TestRemoveSelf(t *testing.T) {
101
ctx, cancel := context.WithCancel(context.Background())
102
defer cancel()
103
api, err := tp.makeAPI(ctx)
@@ -116,7 +116,7 @@ func (tp *provider) TestRemoveSelf(t *testing.T) {
116
}
117
}
118
119
-func (tp *provider) TestGenerate(t *testing.T) {
119
+func (tp *TestSuite) TestGenerate(t *testing.T) {
120
ctx, cancel := context.WithCancel(context.Background())
121
defer cancel()
122
api, err := tp.makeAPI(ctx)
@@ -139,7 +139,7 @@ func (tp *provider) TestGenerate(t *testing.T) {
139
}
140
}
141
142
-func (tp *provider) TestGenerateSize(t *testing.T) {
142
+func (tp *TestSuite) TestGenerateSize(t *testing.T) {
143
ctx, cancel := context.WithCancel(context.Background())
144
defer cancel()
145
api, err := tp.makeAPI(ctx)
@@ -162,7 +162,7 @@ func (tp *provider) TestGenerateSize(t *testing.T) {
162
}
163
}
164
165
-func (tp *provider) TestGenerateType(t *testing.T) {
165
+func (tp *TestSuite) TestGenerateType(t *testing.T) {
166
ctx, cancel := context.WithCancel(context.Background())
167
defer cancel()
168
t.Skip("disabled until libp2p/specs#111 is fixed")
@@ -188,7 +188,7 @@ func (tp *provider) TestGenerateType(t *testing.T) {
188
}
189
}
190
191
-func (tp *provider) TestGenerateExisting(t *testing.T) {
191
+func (tp *TestSuite) TestGenerateExisting(t *testing.T) {
192
ctx, cancel := context.WithCancel(context.Background())
193
defer cancel()
194
api, err := tp.makeAPI(ctx)
@@ -221,7 +221,7 @@ func (tp *provider) TestGenerateExisting(t *testing.T) {
221
}
222
}
223
224
-func (tp *provider) TestList(t *testing.T) {
224
+func (tp *TestSuite) TestList(t *testing.T) {
225
ctx, cancel := context.WithCancel(context.Background())
226
defer cancel()
227
api, err := tp.makeAPI(ctx)
@@ -267,7 +267,7 @@ func (tp *provider) TestList(t *testing.T) {
267
}
268
}
269
270
-func (tp *provider) TestRename(t *testing.T) {
270
+func (tp *TestSuite) TestRename(t *testing.T) {
271
ctx, cancel := context.WithCancel(context.Background())
272
defer cancel()
273
api, err := tp.makeAPI(ctx)
@@ -296,7 +296,7 @@ func (tp *provider) TestRename(t *testing.T) {
296
}
297
}
298
299
-func (tp *provider) TestRenameToSelf(t *testing.T) {
299
+func (tp *TestSuite) TestRenameToSelf(t *testing.T) {
300
ctx, cancel := context.WithCancel(context.Background())
301
defer cancel()
302
api, err := tp.makeAPI(ctx)
@@ -320,7 +320,7 @@ func (tp *provider) TestRenameToSelf(t *testing.T) {
320
}
321
}
322
323
-func (tp *provider) TestRenameToSelfForce(t *testing.T) {
323
+func (tp *TestSuite) TestRenameToSelfForce(t *testing.T) {
324
ctx, cancel := context.WithCancel(context.Background())
325
defer cancel()
326
api, err := tp.makeAPI(ctx)
@@ -344,7 +344,7 @@ func (tp *provider) TestRenameToSelfForce(t *testing.T) {
344
}
345
}
346
347
-func (tp *provider) TestRenameOverwriteNoForce(t *testing.T) {
347
+func (tp *TestSuite) TestRenameOverwriteNoForce(t *testing.T) {
348
ctx, cancel := context.WithCancel(context.Background())
349
defer cancel()
350
api, err := tp.makeAPI(ctx)
@@ -374,7 +374,7 @@ func (tp *provider) TestRenameOverwriteNoForce(t *testing.T) {
374
}
375
}
376
377
-func (tp *provider) TestRenameOverwrite(t *testing.T) {
377
+func (tp *TestSuite) TestRenameOverwrite(t *testing.T) {
378
ctx, cancel := context.WithCancel(context.Background())
379
defer cancel()
380
api, err := tp.makeAPI(ctx)
@@ -413,7 +413,7 @@ func (tp *provider) TestRenameOverwrite(t *testing.T) {
413
}
414
}
415
416
-func (tp *provider) TestRenameSameNameNoForce(t *testing.T) {
416
+func (tp *TestSuite) TestRenameSameNameNoForce(t *testing.T) {
417
ctx, cancel := context.WithCancel(context.Background())
418
defer cancel()
419
api, err := tp.makeAPI(ctx)
@@ -442,7 +442,7 @@ func (tp *provider) TestRenameSameNameNoForce(t *testing.T) {
442
}
443
}
444
445
-func (tp *provider) TestRenameSameName(t *testing.T) {
445
+func (tp *TestSuite) TestRenameSameName(t *testing.T) {
446
ctx, cancel := context.WithCancel(context.Background())
447
defer cancel()
448
api, err := tp.makeAPI(ctx)
@@ -471,7 +471,7 @@ func (tp *provider) TestRenameSameName(t *testing.T) {
471
}
472
}
473
474
-func (tp *provider) TestRemove(t *testing.T) {
474
+func (tp *TestSuite) TestRemove(t *testing.T) {
475
ctx, cancel := context.WithCancel(context.Background())
476
defer cancel()
477
api, err := tp.makeAPI(ctx)
core/coreiface/tests/name.go
+4
-4
@@ -16,7 +16,7 @@ import (
16
opt "github.com/ipfs/interface-go-ipfs-core/options"
17
)
18
19
-func (tp *provider) TestName(t *testing.T) {
19
+func (tp *TestSuite) TestName(t *testing.T) {
20
tp.hasApi(t, func(api coreiface.CoreAPI) error {
21
if api.Name() == nil {
22
return apiNotImplemented
@@ -39,7 +39,7 @@ func appendPath(p path.Path, sub string) path.Path {
39
return path.New(gopath.Join(p.String(), sub))
40
}
41
42
-func (tp *provider) TestPublishResolve(t *testing.T) {
42
+func (tp *TestSuite) TestPublishResolve(t *testing.T) {
43
ctx, cancel := context.WithCancel(context.Background())
44
defer cancel()
45
init := func() (coreiface.CoreAPI, path.Path) {
@@ -188,7 +188,7 @@ func (tp *provider) TestPublishResolve(t *testing.T) {
188
})
189
}
190
191
-func (tp *provider) TestBasicPublishResolveKey(t *testing.T) {
191
+func (tp *TestSuite) TestBasicPublishResolveKey(t *testing.T) {
192
ctx, cancel := context.WithCancel(context.Background())
193
defer cancel()
194
apis, err := tp.MakeAPISwarm(ctx, true, 5)
@@ -230,7 +230,7 @@ func (tp *provider) TestBasicPublishResolveKey(t *testing.T) {
230
}
231
}
232
233
-func (tp *provider) TestBasicPublishResolveTimeout(t *testing.T) {
233
+func (tp *TestSuite) TestBasicPublishResolveTimeout(t *testing.T) {
234
t.Skip("ValidTime doesn't appear to work at this time resolution")
235
236
ctx, cancel := context.WithCancel(context.Background())
core/coreiface/tests/object.go
+13
-13
@@ -12,7 +12,7 @@ import (
12
opt "github.com/ipfs/interface-go-ipfs-core/options"
13
)
14
15
-func (tp *provider) TestObject(t *testing.T) {
15
+func (tp *TestSuite) TestObject(t *testing.T) {
16
tp.hasApi(t, func(api iface.CoreAPI) error {
17
if api.Object() == nil {
18
return apiNotImplemented
@@ -34,7 +34,7 @@ func (tp *provider) TestObject(t *testing.T) {
34
t.Run("TestDiffTest", tp.TestDiffTest)
35
}
36
37
-func (tp *provider) TestNew(t *testing.T) {
37
+func (tp *TestSuite) TestNew(t *testing.T) {
38
ctx, cancel := context.WithCancel(context.Background())
39
defer cancel()
40
api, err := tp.makeAPI(ctx)
@@ -61,7 +61,7 @@ func (tp *provider) TestNew(t *testing.T) {
61
}
62
}
63
64
-func (tp *provider) TestObjectPut(t *testing.T) {
64
+func (tp *TestSuite) TestObjectPut(t *testing.T) {
65
ctx, cancel := context.WithCancel(context.Background())
66
defer cancel()
67
api, err := tp.makeAPI(ctx)
@@ -102,7 +102,7 @@ func (tp *provider) TestObjectPut(t *testing.T) {
102
}
103
}
104
105
-func (tp *provider) TestObjectGet(t *testing.T) {
105
+func (tp *TestSuite) TestObjectGet(t *testing.T) {
106
ctx, cancel := context.WithCancel(context.Background())
107
defer cancel()
108
api, err := tp.makeAPI(ctx)
@@ -125,7 +125,7 @@ func (tp *provider) TestObjectGet(t *testing.T) {
125
}
126
}
127
128
-func (tp *provider) TestObjectData(t *testing.T) {
128
+func (tp *TestSuite) TestObjectData(t *testing.T) {
129
ctx, cancel := context.WithCancel(context.Background())
130
defer cancel()
131
api, err := tp.makeAPI(ctx)
@@ -153,7 +153,7 @@ func (tp *provider) TestObjectData(t *testing.T) {
153
}
154
}
155
156
-func (tp *provider) TestObjectLinks(t *testing.T) {
156
+func (tp *TestSuite) TestObjectLinks(t *testing.T) {
157
ctx, cancel := context.WithCancel(context.Background())
158
defer cancel()
159
api, err := tp.makeAPI(ctx)
@@ -189,7 +189,7 @@ func (tp *provider) TestObjectLinks(t *testing.T) {
189
}
190
}
191
192
-func (tp *provider) TestObjectStat(t *testing.T) {
192
+func (tp *TestSuite) TestObjectStat(t *testing.T) {
193
ctx, cancel := context.WithCancel(context.Background())
194
defer cancel()
195
api, err := tp.makeAPI(ctx)
@@ -237,7 +237,7 @@ func (tp *provider) TestObjectStat(t *testing.T) {
237
}
238
}
239
240
-func (tp *provider) TestObjectAddLink(t *testing.T) {
240
+func (tp *TestSuite) TestObjectAddLink(t *testing.T) {
241
ctx, cancel := context.WithCancel(context.Background())
242
defer cancel()
243
api, err := tp.makeAPI(ctx)
@@ -278,7 +278,7 @@ func (tp *provider) TestObjectAddLink(t *testing.T) {
278
}
279
}
280
281
-func (tp *provider) TestObjectAddLinkCreate(t *testing.T) {
281
+func (tp *TestSuite) TestObjectAddLinkCreate(t *testing.T) {
282
ctx, cancel := context.WithCancel(context.Background())
283
defer cancel()
284
api, err := tp.makeAPI(ctx)
@@ -327,7 +327,7 @@ func (tp *provider) TestObjectAddLinkCreate(t *testing.T) {
327
}
328
}
329
330
-func (tp *provider) TestObjectRmLink(t *testing.T) {
330
+func (tp *TestSuite) TestObjectRmLink(t *testing.T) {
331
ctx, cancel := context.WithCancel(context.Background())
332
defer cancel()
333
api, err := tp.makeAPI(ctx)
@@ -360,7 +360,7 @@ func (tp *provider) TestObjectRmLink(t *testing.T) {
360
}
361
}
362
363
-func (tp *provider) TestObjectAddData(t *testing.T) {
363
+func (tp *TestSuite) TestObjectAddData(t *testing.T) {
364
ctx, cancel := context.WithCancel(context.Background())
365
defer cancel()
366
api, err := tp.makeAPI(ctx)
@@ -393,7 +393,7 @@ func (tp *provider) TestObjectAddData(t *testing.T) {
393
}
394
}
395
396
-func (tp *provider) TestObjectSetData(t *testing.T) {
396
+func (tp *TestSuite) TestObjectSetData(t *testing.T) {
397
ctx, cancel := context.WithCancel(context.Background())
398
defer cancel()
399
api, err := tp.makeAPI(ctx)
@@ -426,7 +426,7 @@ func (tp *provider) TestObjectSetData(t *testing.T) {
426
}
427
}
428
429
-func (tp *provider) TestDiffTest(t *testing.T) {
429
+func (tp *TestSuite) TestDiffTest(t *testing.T) {
430
ctx, cancel := context.WithCancel(context.Background())
431
defer cancel()
432
api, err := tp.makeAPI(ctx)
core/coreiface/tests/path.go
+7
-7
@@ -12,7 +12,7 @@ import (
12
ipldcbor "github.com/ipfs/go-ipld-cbor"
13
)
14
15
-func (tp *provider) TestPath(t *testing.T) {
15
+func (tp *TestSuite) TestPath(t *testing.T) {
16
t.Run("TestMutablePath", tp.TestMutablePath)
17
t.Run("TestPathRemainder", tp.TestPathRemainder)
18
t.Run("TestEmptyPathRemainder", tp.TestEmptyPathRemainder)
@@ -21,7 +21,7 @@ func (tp *provider) TestPath(t *testing.T) {
21
t.Run("TestPathJoin", tp.TestPathJoin)
22
}
23
24
-func (tp *provider) TestMutablePath(t *testing.T) {
24
+func (tp *TestSuite) TestMutablePath(t *testing.T) {
25
ctx, cancel := context.WithCancel(context.Background())
26
defer cancel()
27
api, err := tp.makeAPI(ctx)
@@ -54,7 +54,7 @@ func (tp *provider) TestMutablePath(t *testing.T) {
54
}
55
}
56
57
-func (tp *provider) TestPathRemainder(t *testing.T) {
57
+func (tp *TestSuite) TestPathRemainder(t *testing.T) {
58
ctx, cancel := context.WithCancel(context.Background())
59
defer cancel()
60
api, err := tp.makeAPI(ctx)
@@ -85,7 +85,7 @@ func (tp *provider) TestPathRemainder(t *testing.T) {
85
}
86
}
87
88
-func (tp *provider) TestEmptyPathRemainder(t *testing.T) {
88
+func (tp *TestSuite) TestEmptyPathRemainder(t *testing.T) {
89
ctx, cancel := context.WithCancel(context.Background())
90
defer cancel()
91
api, err := tp.makeAPI(ctx)
@@ -116,7 +116,7 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) {
116
}
117
}
118
119
-func (tp *provider) TestInvalidPathRemainder(t *testing.T) {
119
+func (tp *TestSuite) TestInvalidPathRemainder(t *testing.T) {
120
ctx, cancel := context.WithCancel(context.Background())
121
defer cancel()
122
api, err := tp.makeAPI(ctx)
@@ -143,7 +143,7 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) {
143
}
144
}
145
146
-func (tp *provider) TestPathRoot(t *testing.T) {
146
+func (tp *TestSuite) TestPathRoot(t *testing.T) {
147
ctx, cancel := context.WithCancel(context.Background())
148
defer cancel()
149
api, err := tp.makeAPI(ctx)
@@ -187,7 +187,7 @@ func (tp *provider) TestPathRoot(t *testing.T) {
187
}
188
}
189
190
-func (tp *provider) TestPathJoin(t *testing.T) {
190
+func (tp *TestSuite) TestPathJoin(t *testing.T) {
191
p1 := path.New("/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz")
192
193
if path.Join(p1, "foo").String() != "/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz/foo" {
core/coreiface/tests/pin.go
+4
-4
@@ -14,7 +14,7 @@ import (
14
ipld "github.com/ipfs/go-ipld-format"
15
)
16
17
-func (tp *provider) TestPin(t *testing.T) {
17
+func (tp *TestSuite) TestPin(t *testing.T) {
18
tp.hasApi(t, func(api iface.CoreAPI) error {
19
if api.Pin() == nil {
20
return apiNotImplemented
@@ -27,7 +27,7 @@ func (tp *provider) TestPin(t *testing.T) {
27
t.Run("TestPinRecursive", tp.TestPinRecursive)
28
}
29
30
-func (tp *provider) TestPinAdd(t *testing.T) {
30
+func (tp *TestSuite) TestPinAdd(t *testing.T) {
31
ctx, cancel := context.WithCancel(context.Background())
32
defer cancel()
33
api, err := tp.makeAPI(ctx)
@@ -46,7 +46,7 @@ func (tp *provider) TestPinAdd(t *testing.T) {
46
}
47
}
48
49
-func (tp *provider) TestPinSimple(t *testing.T) {
49
+func (tp *TestSuite) TestPinSimple(t *testing.T) {
50
ctx, cancel := context.WithCancel(context.Background())
51
defer cancel()
52
api, err := tp.makeAPI(ctx)
@@ -96,7 +96,7 @@ func (tp *provider) TestPinSimple(t *testing.T) {
96
}
97
}
98
99
-func (tp *provider) TestPinRecursive(t *testing.T) {
99
+func (tp *TestSuite) TestPinRecursive(t *testing.T) {
100
ctx, cancel := context.WithCancel(context.Background())
101
defer cancel()
102
api, err := tp.makeAPI(ctx)
core/coreiface/tests/pubsub.go
+2
-2
@@ -9,7 +9,7 @@ import (
9
"github.com/ipfs/interface-go-ipfs-core/options"
10
)
11
12
-func (tp *provider) TestPubSub(t *testing.T) {
12
+func (tp *TestSuite) TestPubSub(t *testing.T) {
13
tp.hasApi(t, func(api iface.CoreAPI) error {
14
if api.PubSub() == nil {
15
return apiNotImplemented
@@ -20,7 +20,7 @@ func (tp *provider) TestPubSub(t *testing.T) {
20
t.Run("TestBasicPubSub", tp.TestBasicPubSub)
21
}
22
23
-func (tp *provider) TestBasicPubSub(t *testing.T) {
23
+func (tp *TestSuite) TestBasicPubSub(t *testing.T) {
24
ctx, cancel := context.WithCancel(context.Background())
25
defer cancel()
26
core/coreiface/tests/unixfs.go
+13
-13
@@ -28,7 +28,7 @@ import (
28
mh "github.com/multiformats/go-multihash"
29
)
30
31
-func (tp *provider) TestUnixfs(t *testing.T) {
31
+func (tp *TestSuite) TestUnixfs(t *testing.T) {
32
tp.hasApi(t, func(api coreiface.CoreAPI) error {
33
if api.Unixfs() == nil {
34
return apiNotImplemented
@@ -94,7 +94,7 @@ func wrapped(names ...string) func(f files.Node) files.Node {
94
}
95
}
96
97
-func (tp *provider) TestAdd(t *testing.T) {
97
+func (tp *TestSuite) TestAdd(t *testing.T) {
98
ctx, cancel := context.WithCancel(context.Background())
99
defer cancel()
100
api, err := tp.makeAPI(ctx)
@@ -528,7 +528,7 @@ func (tp *provider) TestAdd(t *testing.T) {
528
}
529
}
530
531
-func (tp *provider) TestAddPinned(t *testing.T) {
531
+func (tp *TestSuite) TestAddPinned(t *testing.T) {
532
ctx, cancel := context.WithCancel(context.Background())
533
defer cancel()
534
api, err := tp.makeAPI(ctx)
@@ -554,7 +554,7 @@ func (tp *provider) TestAddPinned(t *testing.T) {
554
}
555
}
556
557
-func (tp *provider) TestAddHashOnly(t *testing.T) {
557
+func (tp *TestSuite) TestAddHashOnly(t *testing.T) {
558
ctx, cancel := context.WithCancel(context.Background())
559
defer cancel()
560
api, err := tp.makeAPI(ctx)
@@ -580,7 +580,7 @@ func (tp *provider) TestAddHashOnly(t *testing.T) {
580
}
581
}
582
583
-func (tp *provider) TestGetEmptyFile(t *testing.T) {
583
+func (tp *TestSuite) TestGetEmptyFile(t *testing.T) {
584
ctx, cancel := context.WithCancel(context.Background())
585
defer cancel()
586
api, err := tp.makeAPI(ctx)
@@ -610,7 +610,7 @@ func (tp *provider) TestGetEmptyFile(t *testing.T) {
610
}
611
}
612
613
-func (tp *provider) TestGetDir(t *testing.T) {
613
+func (tp *TestSuite) TestGetDir(t *testing.T) {
614
ctx, cancel := context.WithCancel(context.Background())
615
defer cancel()
616
api, err := tp.makeAPI(ctx)
@@ -643,7 +643,7 @@ func (tp *provider) TestGetDir(t *testing.T) {
643
}
644
}
645
646
-func (tp *provider) TestGetNonUnixfs(t *testing.T) {
646
+func (tp *TestSuite) TestGetNonUnixfs(t *testing.T) {
647
ctx, cancel := context.WithCancel(context.Background())
648
defer cancel()
649
api, err := tp.makeAPI(ctx)
@@ -663,7 +663,7 @@ func (tp *provider) TestGetNonUnixfs(t *testing.T) {
663
}
664
}
665
666
-func (tp *provider) TestLs(t *testing.T) {
666
+func (tp *TestSuite) TestLs(t *testing.T) {
667
ctx, cancel := context.WithCancel(context.Background())
668
defer cancel()
669
api, err := tp.makeAPI(ctx)
@@ -723,7 +723,7 @@ func (tp *provider) TestLs(t *testing.T) {
723
}
724
}
725
726
-func (tp *provider) TestEntriesExpired(t *testing.T) {
726
+func (tp *TestSuite) TestEntriesExpired(t *testing.T) {
727
ctx, cancel := context.WithCancel(context.Background())
728
defer cancel()
729
api, err := tp.makeAPI(ctx)
@@ -765,7 +765,7 @@ func (tp *provider) TestEntriesExpired(t *testing.T) {
765
}
766
}
767
768
-func (tp *provider) TestLsEmptyDir(t *testing.T) {
768
+func (tp *TestSuite) TestLsEmptyDir(t *testing.T) {
769
ctx, cancel := context.WithCancel(context.Background())
770
defer cancel()
771
api, err := tp.makeAPI(ctx)
@@ -794,7 +794,7 @@ func (tp *provider) TestLsEmptyDir(t *testing.T) {
794
}
795
796
// TODO(lgierth) this should test properly, with len(links) > 0
797
-func (tp *provider) TestLsNonUnixfs(t *testing.T) {
797
+func (tp *TestSuite) TestLsNonUnixfs(t *testing.T) {
798
ctx, cancel := context.WithCancel(context.Background())
799
defer cancel()
800
api, err := tp.makeAPI(ctx)
@@ -853,7 +853,7 @@ func (f *closeTestF) Close() error {
853
return nil
854
}
855
856
-func (tp *provider) TestAddCloses(t *testing.T) {
856
+func (tp *TestSuite) TestAddCloses(t *testing.T) {
857
ctx, cancel := context.WithCancel(context.Background())
858
defer cancel()
859
api, err := tp.makeAPI(ctx)
@@ -891,7 +891,7 @@ func (tp *provider) TestAddCloses(t *testing.T) {
891
}
892
}
893
894
-func (tp *provider) TestGetSeek(t *testing.T) {
894
+func (tp *TestSuite) TestGetSeek(t *testing.T) {
895
ctx, cancel := context.WithCancel(context.Background())
896
defer cancel()
897
api, err := tp.makeAPI(ctx)