This repository has been archived by the owner on Mar 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 300
feat: modular interface tests #785
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b27658c
feat: uses modular interface tests
alanshaw c2e4af4
feat: skip unimplemented files tests and add ls* tests
alanshaw f325e50
fix: adds skips for #339
alanshaw 6f711b9
fix: adds skips for key and miscellaneous
alanshaw 84f1122
feat: add types and util tests (skipped as currently failing)
alanshaw 2f6d041
feat: add pin tests
alanshaw dec9d50
fix(pubsub): adds skips for tests on windows
alanshaw a3a064b
fix(config): adds skip for config.replace
alanshaw 4da4309
chore: re-adds bitswap tests
alanshaw 0ef6710
chore: move detect-node back to dependencies
alanshaw e81e4e5
chore: add skip reasons
alanshaw 8cf8aaa
chore: update interface-ipfs-core dependency
alanshaw 6d34481
chore: add reason for pubsub in browser skips
alanshaw ba69bd8
chore: add bitswap skips for offline errors
alanshaw b02e95b
fix: remove skip for test that was removed
alanshaw 6413fa1
chore: update interface-ipfs-core version
alanshaw 694989d
chore: update deps and test on CI (#802)
daviddias dc1cb72
chore: update interface-ipfs-core
daviddias c53d3cd
fix(dag): `dag.put()` allows for optional options (#801)
0x-r4bbit 1781f2a
fix: skip bitswap offline tests on all platforms
alanshaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const tests = require('interface-ipfs-core') | ||
const isNode = require('detect-node') | ||
const CommonFactory = require('./utils/interface-common-factory') | ||
const IPFSApi = require('../src') | ||
const isWindows = process.platform && process.platform === 'win32' | ||
|
||
describe('interface-ipfs-core tests', () => { | ||
const defaultCommonFactory = CommonFactory.create() | ||
|
||
tests.bitswap(defaultCommonFactory, { | ||
skip: [ | ||
// bitswap.stat | ||
{ | ||
name: 'should not get bitswap stats when offline', | ||
reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078' | ||
}, | ||
// bitswap.wantlist | ||
{ | ||
name: 'should not get the wantlist when offline', | ||
reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078' | ||
}, | ||
// bitswap.unwant | ||
{ | ||
name: 'should remove a key from the wantlist', | ||
reason: 'FIXME why is this skipped?' | ||
}, | ||
{ | ||
name: 'should not remove a key from the wantlist when offline', | ||
reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078' | ||
} | ||
] | ||
}) | ||
|
||
tests.block(defaultCommonFactory) | ||
|
||
tests.bootstrap(defaultCommonFactory) | ||
|
||
tests.config(defaultCommonFactory, { | ||
skip: [ | ||
// config.replace | ||
{ | ||
name: 'replace', | ||
reason: 'FIXME Waiting for fix on go-ipfs https://github.com/ipfs/js-ipfs-api/pull/307#discussion_r69281789 and https://github.com/ipfs/go-ipfs/issues/2927' | ||
} | ||
] | ||
}) | ||
|
||
tests.dag(defaultCommonFactory, { | ||
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' | ||
} | ||
] | ||
}) | ||
|
||
tests.dht(defaultCommonFactory, { | ||
skip: [ | ||
// dht.findpeer | ||
{ | ||
name: 'should fail to find other peer if peer does not exist', | ||
reason: 'FIXME checking what is exactly go-ipfs returning https://github.com/ipfs/go-ipfs/issues/3862#issuecomment-294168090' | ||
}, | ||
// dht.findprovs | ||
{ | ||
name: 'should provide from one node and find it through another node', | ||
reason: 'FIXME go-ipfs endpoint doesn\'t conform with the others https://github.com/ipfs/go-ipfs/issues/5047' | ||
}, | ||
// dht.get | ||
{ | ||
name: 'should get a value after it was put on another node', | ||
reason: 'FIXME go-ipfs errors with Error: key was not found (type 6) https://github.com/ipfs/go-ipfs/issues/3862' | ||
} | ||
] | ||
}) | ||
|
||
tests.files(defaultCommonFactory, { | ||
skip: [ | ||
// files.add | ||
isNode ? null : { | ||
name: 'should add a nested directory as array of tupples', | ||
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' | ||
}, | ||
isNode ? null : { | ||
name: 'should add a nested directory as array of tupples with progress', | ||
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' | ||
}, | ||
// files.addPullStream | ||
isNode ? null : { | ||
name: 'should add pull stream of valid files and dirs', | ||
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' | ||
}, | ||
// files.addReadableStream | ||
isNode ? null : { | ||
name: 'should add readable stream of valid files and dirs', | ||
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' | ||
}, | ||
// files.catPullStream | ||
{ | ||
name: 'should export a chunk of a file', | ||
reason: 'TODO not implemented in go-ipfs yet' | ||
}, | ||
{ | ||
name: 'should export a chunk of a file in a Pull Stream', | ||
reason: 'TODO not implemented in go-ipfs yet' | ||
}, | ||
{ | ||
name: 'should export a chunk of a file in a Readable Stream', | ||
reason: 'TODO not implemented in go-ipfs yet' | ||
}, | ||
// files.get | ||
isNode ? null : { | ||
name: 'should get a directory', | ||
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' | ||
} | ||
] | ||
}) | ||
|
||
tests.key(defaultCommonFactory, { | ||
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.ls(defaultCommonFactory, { | ||
skip: [ | ||
// lsPullStream | ||
isNode ? null : { | ||
name: 'should pull stream ls with a base58 encoded CID', | ||
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' | ||
}, | ||
// lsReadableStream | ||
isNode ? null : { | ||
name: 'should readable stream ls with a base58 encoded CID', | ||
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' | ||
}, | ||
// ls | ||
isNode ? null : { | ||
name: 'should ls with a base58 encoded CID', | ||
reason: 'FIXME https://github.com/ipfs/js-ipfs-api/issues/339' | ||
} | ||
] | ||
}) | ||
|
||
tests.miscellaneous(defaultCommonFactory, { | ||
skip: [ | ||
// stop | ||
{ | ||
name: 'should stop the node', | ||
reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078' | ||
} | ||
] | ||
}) | ||
|
||
tests.object(defaultCommonFactory) | ||
|
||
tests.pin(defaultCommonFactory) | ||
|
||
tests.ping(defaultCommonFactory) | ||
|
||
tests.pubsub(CommonFactory.create({ | ||
spawnOptions: { | ||
args: ['--enable-pubsub-experiment'], | ||
initOptions: { bits: 1024 } | ||
} | ||
}), { | ||
skip: isNode ? [ | ||
// pubsub.subscribe | ||
isWindows ? { | ||
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' | ||
} : null, | ||
isWindows ? { | ||
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 | ||
] : { | ||
reason: 'FIXME pubsub is not supported in the browser https://github.com/ipfs/js-ipfs-api/issues/518' | ||
} | ||
}) | ||
|
||
tests.repo(defaultCommonFactory) | ||
|
||
tests.stats(defaultCommonFactory) | ||
|
||
tests.swarm(CommonFactory.create({ | ||
createSetup ({ ipfsFactory, nodes }) { | ||
return callback => { | ||
callback(null, { | ||
spawnNode (repoPath, config, cb) { | ||
if (typeof repoPath === 'function') { | ||
cb = repoPath | ||
repoPath = undefined | ||
} | ||
|
||
if (typeof config === 'function') { | ||
cb = config | ||
config = undefined | ||
} | ||
|
||
const spawnOptions = { repoPath, config, initOptions: { bits: 1024 } } | ||
|
||
ipfsFactory.spawn(spawnOptions, (err, _ipfsd) => { | ||
if (err) { | ||
return cb(err) | ||
} | ||
|
||
nodes.push(_ipfsd) | ||
cb(null, IPFSApi(_ipfsd.apiAddr)) | ||
}) | ||
} | ||
}) | ||
} | ||
} | ||
})) | ||
|
||
tests.types(defaultCommonFactory, { skip: { reason: 'FIXME currently failing' } }) | ||
|
||
tests.util(defaultCommonFactory, { skip: { reason: 'FIXME currently failing' } }) | ||
}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use
1024
for all tests? It would make things way faster.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this was actually lost with this change, before all tests used 1024.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They still are, the
defaultCommonFactory
passed to other suites uses 1024 by default https://github.com/ipfs/js-ipfs-api/pull/785/files/519bbf5c4374317d5355d9bddfb2fc5862ddd16d#diff-b4ff00e5aeab8b441e96f3d0b1082a2eR12There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood! Thanks :)