Closed aphelionz closed 4 years ago
You are a hero 🙌
Opted not to re-export Ctl
but instead create a factory with the settings we'd want, and then extended that factory's prototype to include two functions:
spawnApi
to deal with the simple boilerplate of:const ipfsd = factory.spawn()
const ipfs = ipfsd.api
localCluster
, which is where the real magic [can] happen, which takes an array of ipfs types like js
, go
, proc
, etc, connects them all via permutation, and then returns the array of connected nodes.I'm only testing with proc
right now. I think this approach will be promising and I'll be playing with using it in ipfs-log
tomorrow.
~I also may put back startIpfs
and stopIpfs
just so I'm not needlessly breaking the previously written tests.~
startIpfs
, stopIpfs
, and testApis
were restored to not unnecessarily break existing tests, and a deprecation warning was added.
Ran into an error after rm -rf node_modules package-lock.json
and npm install
:
Error: invalid block
at Object.put (node_modules/ipfs-repo/src/blockstore.js:76:15)
at BlockService.put (node_modules/ipfs-block-service/src/index.js:63:32)
at IPLDResolver.put (node_modules/ipld/src/index.js:196:21)
at async Object.put (node_modules/ipfs/src/core/components/dag/put.js:48:1
9)
at async Proxy.init (node_modules/ipfs/src/core/components/init.js:128:27)
at async InProc.init (node_modules/ipfsd-ctl/src/ipfsd-in-proc.js:93:5)
at async Factory.spawn (node_modules/ipfsd-ctl/src/factory.js:141:7)
at async Promise.all (index 5)
at async Factory.factory.constructor.localSwarm (index.js:5:692)
at async Context.<anonymous> (test/workflow.spec.js:91:21)
This PR updates:
go-ipfs-dep
to~0.5.0
ipfs
to~0.43.0
ipfs-repo
to^1.0.1
ipfsd-ctl
to^3.1.0
Also, updating
ipfsd-ctl
allowed me to (at least attempt to) clean up this a bit. I ~removedstartIpfs
andstopIpfs
~ created a factory object with preferred configuration fromipfsd-ctl
. I extended the prototype to create two new functions to the factory:spawnApi
to deal with the simple boilerplate of:localCluster
, which is where the real magic [can] happen, which takes an array of ipfs types likejs
,go
,proc
, etc, connects them all via permutation, and then returns the array of connected nodes.It will take refactoring the downstream tests a but but I believe this gives us a few advantages:
js
andgo
nodes in the same tests, while also still being able to loop through['js', 'go']
in our tests like we usually do, if we want. Note that we can also still usewaitForPeers
, andconnectPeers
.factory.clean()
method in theafter
methods in our mocha tests to properly clean up all the spawned daemons and not run into any more issues where the process doesn't close.Tradeoffs
ipfsd-cts
exports someipfsd
object, where the object we really want itipfsd.api
. Just an extra thing but I couldn't find a place to really return that properly to keep things consistent.~ taken care of :tada:implementations
business to be dealt with, see my self-review comments below.TODO if/when approved
process.env.TEST
support0.9.0
npm install
time onmaster
(Thinkpad W540, 8 cores, 24GB ram)real 1m32.161s user 1m26.220s sys 0m11.440s
Code coverage: