forked from ipfs/js-ipfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface-http-go.js
619 lines (597 loc) · 20.1 KB
/
interface-http-go.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
/* eslint-env mocha */
'use strict'
const tests = require('interface-ipfs-core')
const factory = require('./utils/factory')
const isWindows = global.process && global.process.platform && global.process.platform === 'win32'
/** @typedef {import("ipfsd-ctl").ControllerOptions} ControllerOptions */
describe('interface-ipfs-core over ipfs-http-client tests against go-ipfs', () => {
const commonFactory = factory({
type: 'go'
})
tests.root(commonFactory, {
skip: [
{
name: 'should add with mode as string',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should add with mode as number',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should add with mtime as Date',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should add with mtime as { nsecs, secs }',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should add with mtime as timespec',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should add with mtime as hrtime',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should export a chunk of a file',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should ls with metadata',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should ls single file with metadata',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should ls single file without containing directory with metadata',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should override raw leaves when file is smaller than one block and metadata is present',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should support bidirectional streaming',
reason: 'Not supported by http'
},
{
name: 'should error during add-all stream',
reason: 'Not supported by http'
}
]
})
tests.bitswap(commonFactory, {
skip: [
{
name: '.bitswap.unwant',
reason: 'TODO not implemented in go-ipfs yet'
}
]
})
tests.block(commonFactory, {
skip: [{
name: 'should get a block added as CIDv1 with a CIDv0',
reason: 'go-ipfs does not support the `version` param'
}]
})
tests.bootstrap(commonFactory)
tests.config(commonFactory, {
skip: [
// config.replace
{
name: 'replace',
reason: 'FIXME Waiting for fix on go-ipfs https://github.com/ipfs/js-ipfs-http-client/pull/307#discussion_r69281789 and https://github.com/ipfs/go-ipfs/issues/2927'
},
{
name: 'should respect timeout option when listing config profiles',
reason: 'TODO: Not implemented in go-ipfs'
},
{
name: 'should list config profiles',
reason: 'TODO: Not implemented in go-ipfs'
},
{
name: 'should strip private key from diff output',
reason: 'TODO: Not implemented in go-ipfs'
}
]
})
tests.dag(commonFactory, {
skip: [
// dag.tree
{
name: 'tree',
reason: 'TODO vmx 2018-02-22: Currently the tree API is not exposed in go-ipfs'
},
// dag.get:
{
name: 'should get a dag-pb node local value',
reason: 'FIXME vmx 2018-02-22: Currently not supported in go-ipfs, it might be possible once https://github.com/ipfs/go-ipfs/issues/4728 is done'
},
{
name: 'should get dag-pb value via dag-cbor node',
reason: 'FIXME vmx 2018-02-22: Currently not supported in go-ipfs, it might be possible once https://github.com/ipfs/go-ipfs/issues/4728 is done'
},
{
name: 'should get by CID string + path',
reason: 'FIXME vmx 2018-02-22: Currently not supported in go-ipfs, it might be possible once https://github.com/ipfs/go-ipfs/issues/4728 is done'
},
{
name: 'should get only a CID, due to resolving locally only',
reason: 'FIXME: go-ipfs does not support localResolve option'
}
]
})
tests.dht(commonFactory)
tests.files(commonFactory, {
skip: [
{
name: 'should ls directory',
reason: 'TODO unskip when go-ipfs supports --long https://github.com/ipfs/go-ipfs/pull/6528'
},
{
name: 'should list a file directly',
reason: 'TODO unskip when go-ipfs supports --long https://github.com/ipfs/go-ipfs/pull/6528'
},
{
name: 'should ls directory and include metadata',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should read from outside of mfs',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should ls from outside of mfs',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should respect timeout option when changing the mode of a file',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should update the mode for a file',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should update the mode for a directory',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should update the mode for a hamt-sharded-directory',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should update modes with basic symbolic notation that adds bits',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should update modes with basic symbolic notation that removes bits',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should update modes with basic symbolic notation that overrides bits',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should update modes with multiple symbolic notation',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should update modes with special symbolic notation',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should apply special execute permissions to world',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should apply special execute permissions to user',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should apply special execute permissions to user and group',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should apply special execute permissions to sharded directories',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should update file mtime',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should update directory mtime',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should update the mtime for a hamt-sharded-directory',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should create an empty file',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should make directory and specify mode',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should make directory and specify mtime',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should write file and specify mode',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should write file and specify mtime',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should respect metadata when copying files',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should respect metadata when copying directories',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should respect metadata when copying from outside of mfs',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should respect timeout option when updating the modification time of files',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should have default mtime',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should set mtime as Date',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should set mtime as { nsecs, secs }',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should set mtime as timespec',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should set mtime as hrtime',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should make directory and have default mode',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should make directory and specify mode as string',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should make directory and specify mode as number',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should make directory and specify mtime as Date',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should make directory and specify mtime as { nsecs, secs }',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should make directory and specify mtime as timespec',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should make directory and specify mtime as hrtime',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should write file and specify mode as a string',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should write file and specify mode as a number',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should write file and specify mtime as Date',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should write file and specify mtime as { nsecs, secs }',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should write file and specify mtime as timespec',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should write file and specify mtime as hrtime',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should stat file with mode',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should stat file with mtime',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should stat dir with mode',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should stat dir with mtime',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should stat sharded dir with mode',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should stat sharded dir with mtime',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'lists a raw node',
reason: 'TODO go-ipfs does not support ipfs paths for all mfs commands'
},
{
name: 'lists a raw node in an mfs directory',
reason: 'TODO go-ipfs does not support non-ipfs nodes in mfs'
},
{
name: 'writes a small file with an escaped slash in the title',
reason: 'TODO go-ipfs does not support escapes in paths'
},
{
name: 'overwrites a file with a different CID version',
reason: 'TODO go-ipfs does not support changing the CID version'
},
{
name: 'partially overwrites a file with a different CID version',
reason: 'TODO go-ipfs does not support changing the CID version'
},
{
name: 'refuses to copy multiple files to a non-existent child directory',
reason: 'TODO go-ipfs does not support copying multiple files at once'
},
{
name: 'refuses to copy files to an unreadable node',
reason: 'TODO go-ipfs does not support identity format, maybe in 0.5.0?'
},
{
name: 'copies a file to a pre-existing directory',
reason: 'TODO go-ipfs does not copying files into existing directories if the directory is specify as the target path'
},
{
name: 'copies multiple files to new location',
reason: 'TODO go-ipfs does not support copying multiple files at once'
},
{
name: 'copies files to deep mfs paths and creates intermediate directories',
reason: 'TODO go-ipfs does not support the parents flag in the cp command'
},
{
name: 'copies a sharded directory to a normal directory',
reason: 'TODO go-ipfs does not copying files into existing directories if the directory is specify as the target path'
},
{
name: 'copies a normal directory to a sharded directory',
reason: 'TODO go-ipfs does not copying files into existing directories if the directory is specify as the target path'
},
{
name: 'removes multiple files',
reason: 'TODO go-ipfs does not support removing multiple files'
},
{
name: 'results in the same hash as a sharded directory created by the importer when removing a file',
reason: 'TODO go-ipfs errors out with HTTPError: Could not convert value "85675" to type "bool" (for option "-size")'
},
{
name: 'results in the same hash as a sharded directory created by the importer when removing a subshard',
reason: 'TODO go-ipfs errors out with HTTPError: Could not convert value "2109" to type "bool" (for option "-size")'
},
{
name: 'results in the same hash as a sharded directory created by the importer when removing a file from a subshard of a subshard',
reason: 'TODO go-ipfs errors out with HTTPError: Could not convert value "170441" to type "bool" (for option "-size")'
},
{
name: 'results in the same hash as a sharded directory created by the importer when removing a subshard of a subshard',
reason: 'TODO go-ipfs errors out with HTTPError: Could not convert value "11463" to type "bool" (for option "-size")'
},
{
name: 'results in the same hash as a sharded directory created by the importer when adding a new file',
reason: 'TODO go-ipfs errors out with HTTPError: Could not convert value "5835" to type "bool" (for option "-size")'
},
{
name: 'results in the same hash as a sharded directory created by the importer when creating a new subshard',
reason: 'TODO go-ipfs errors out with HTTPError: Could not convert value "8038" to type "bool" (for option "-size")'
},
{
name: ' results in the same hash as a sharded directory created by the importer when adding a file to a subshard',
reason: 'TODO go-ipfs errors out with HTTPError: Could not convert value "6620" to type "bool" (for option "-size")'
},
{
name: 'results in the same hash as a sharded directory created by the importer when adding a file to a subshard',
reason: 'HTTPError: Could not convert value "6620" to type "bool" (for option "-size")'
},
{
name: 'results in the same hash as a sharded directory created by the importer when adding a file to a subshard of a subshard',
reason: 'HTTPError: Could not convert value "170441" to type "bool" (for option "-size")'
},
{
name: 'stats a dag-cbor node',
reason: 'TODO go-ipfs does not support non-dag-pb nodes in mfs'
},
{
name: 'stats an identity CID',
reason: 'TODO go-ipfs does not support non-dag-pb nodes in mfs'
},
{
name: 'limits how many bytes to write to a file (Really large file)',
reason: 'TODO go-ipfs drops the connection'
}
]
})
tests.key(commonFactory, {
skip: [
// key.export
{
name: 'export',
reason: 'TODO not implemented in go-ipfs yet'
},
// key.import
{
name: 'import',
reason: 'TODO not implemented in go-ipfs yet'
}
]
})
tests.miscellaneous(commonFactory, {
skip: [
{
name: 'should include the interface-ipfs-core version',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should include the ipfs-http-client version',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should have protocols property',
reason: 'TODO not implemented in go-ipfs yet'
}
]
})
tests.name(factory({
type: 'go',
ipfsOptions: {
offline: true
}
}), {
skip: [
{
name: 'should resolve a record from peerid as cidv1 in base32',
reason: 'TODO not implemented in go-ipfs yet: https://github.com/ipfs/go-ipfs/issues/5287'
}
]
})
tests.namePubsub(factory({
type: 'go',
ipfsOptions: {
EXPERIMENTAL: {
ipnsPubsub: true
}
}
}), {
skip: [
// name.pubsub.cancel
{
name: 'should cancel a subscription correctly returning true',
reason: 'go-ipfs is really slow for publishing and resolving ipns records, unless in offline mode'
},
// name.pubsub.subs
{
name: 'should get the list of subscriptions updated after a resolve',
reason: 'go-ipfs is really slow for publishing and resolving ipns records, unless in offline mode'
},
// name.pubsub
{
name: 'should publish and then resolve correctly',
reason: 'js-ipfs and go-ipfs behaviour differs'
},
{
name: 'should self resolve, publish and then resolve correctly',
reason: 'js-ipfs and go-ipfs behaviour differs'
},
{
name: 'should handle event on publish correctly',
reason: 'js-ipfs and go-ipfs behaviour differs'
}
]
})
tests.object(commonFactory, {
skip: [
{
name: 'should get data by base58 encoded multihash string',
reason: 'FIXME go-ipfs throws invalid encoding: base58'
},
{
name: 'should get object by base58 encoded multihash',
reason: 'FIXME go-ipfs throws invalid encoding: base58'
},
{
name: 'should get object by base58 encoded multihash',
reason: 'FIXME go-ipfs throws invalid encoding: base58'
},
{
name: 'should get object by base58 encoded multihash string',
reason: 'FIXME go-ipfs throws invalid encoding: base58'
},
{
name: 'should get links by base58 encoded multihash',
reason: 'FIXME go-ipfs throws invalid encoding: base58'
},
{
name: 'should get links by base58 encoded multihash string',
reason: 'FIXME go-ipfs throws invalid encoding: base58'
},
{
name: 'should put a Protobuf encoded Uint8Array',
reason: 'FIXME go-ipfs throws invalid encoding: protobuf'
}
]
})
tests.pin(commonFactory, {
skip: [
{
name: 'should list pins with metadata',
reason: 'not implemented in go-ipfs'
}
]
})
tests.ping(commonFactory, {
skip: [
{
name: 'should fail when pinging a peer that is not available',
reason: 'FIXME go-ipfs return success with text: Looking up peer <cid>'
}
]
})
tests.pubsub(factory({
type: 'go'
}, {
go: {
args: ['--enable-pubsub-experiment']
}
}), {
skip: isWindows ? [
// pubsub.subscribe
{
name: 'should send/receive 100 messages',
reason: 'FIXME https://github.com/ipfs/interface-ipfs-core/pull/188#issuecomment-354673246 and https://github.com/ipfs/go-ipfs/issues/4778'
},
{
name: 'should receive multiple messages',
reason: 'FIXME https://github.com/ipfs/interface-ipfs-core/pull/188#issuecomment-354673246 and https://github.com/ipfs/go-ipfs/issues/4778'
}
] : null
})
tests.repo(commonFactory)
tests.stats(commonFactory)
tests.swarm(commonFactory)
})