-
Notifications
You must be signed in to change notification settings - Fork 1.2k
PubSub Interop Tests and CLI+HTTP-API Implementation #1081
Conversation
The pubsub tests need to enable the pubsub experiment in the IPFS server. |
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.
I like the direction of this PR. I've rebased master after merging the other PubSub changes. Will wait for the rest of the changes :)
src/core/components/no-floodsub.js
Outdated
|
||
} | ||
|
||
module.exports = NoFloodSub |
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.
Good approach!
self._pubsub = self._options.EXPERIMENTAL.pubsub | ||
? new FloodSub(self._libp2pNode) | ||
: new NoFloodSub() | ||
self._pubsub.start(done) |
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.
Awesome!
The pubsub spec specifies that published data is a How can these two interop? Consider a buffer with [0x00, 0x01]. What is its |
@richardschneider go-ipfs will just toJSON and base64 that when it comes down to the CLI, since you will be using js-ipfs and js-ipfs-api as a client to go-ipfs, you won't need to think about Strings. |
@diasdavid Yes, at the CLI level everything works. This is because CLI starts with a string not a buffer. At the API things fail if we start with a buffer that does not contain UTF-8 encoded data. This test fails.
|
I'll let someone else deal with this. @diasdavid do you want to raise an issue? |
The interop tests are not working because of libp2p/js-libp2p-floodsub#50 |
@diasdavid Could you review the interop test. I think its correct, but Here's the test run (PS: don't worry about
|
@diasdavid my apologies. It looks like I broke libp2p-floodsub. topicCID is used in internal RPC messages. I should only change to topicID for our subscribers. |
@richardschneider Does that mean that you now have a fully working interop test for pubsub just waiting for some PR to be merged? If that is so, then awesome! I do not feel that the mistake was your fault, just a fault of lack of tests + lack of well written spec that would avoid that confusion. Fortunately, thanks to semver this problem never got shipped to users of js-ipfs. Let's fix it asap and get this interop tests in! Thanks for building all of this :) Are you working towards fixing the bug introduced with libp2p/js-libp2p-floodsub@b8f66cd ? |
@diasdavid Yes, I have pubsub interop tests. They may need a bit of refactoring. Some are still failing. Which I think is attributable to bad floodsub code. I'm working on both issues now. |
Note that binary data from JS to GO fails
# Conflicts: # test/fixtures/go-ipfs-repo/version # test/interop/pubsub.js
@diasdavid Sending binary data from JS to GO fails; see the discussion on ipfs-inactive/interface-js-ipfs-core#171 |
@richardschneider it looks like the problem is in the js-ipfs API server. Apparently it fails because it tries translating the query arg containing arbitrary data into a string, and those bytes the test is sending produces an invalid string.. |
@richardschneider 9d83fa3 should solve the problem. |
@pgte did you test with the latest floodsub PR? |
@diasdavid yes I did. A lot of js-ipfs tests fail, though. Trying to figure out why.. |
@pgte Thanks for
you need to
Which files? I've been looking on interface-ipfs-core\src\pubsub and may have a fix |
@richardschneider thanks for the heads up about binary-querystring! — it should be fixed now. npm-linking the master of ipfsd-ctl into ipfs-api did not solve the test issue: Any hints? |
Updated js-ipfs-api and js-ipfsd-ctl and I still get this error:
|
@@ -40,8 +40,7 @@ class GoDaemon { | |||
this.node = node | |||
this.node.setConfig('Bootstrap', '[]', cb) | |||
}, | |||
(res, cb) => this.node.startDaemon(cb), | |||
// (res, cb) => this.node.startDaemon(this.flags, cb), |
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.
It is this change causing the latest error
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.
The 2nd line should not be commented out. It's needed to pass --enable-pubsub-experiment
to the daemon.
@richardschneider yes, my local js-pifs-api is using latest master. |
Going to squash and merge this branch into |
* feat: PubSub Interop Tests and CLI+HTTP-API Implementation (#1081) * test: enable pubsub tests * fix: generate meaniful error when pubsub is called and not enabled * test: enable pubsub for factory daemon * test: enable pubsub tests * fix: generate meaniful error when pubsub is called and not enabled * test: enable pubsub for factory daemon * fiix(pubsub-subscribe): stop HAPI gzip from buffering our streamed response * test: fix spec/pubsub * fix: lint errors * test: tests js/go pubsub interop * test: pubsub interop tests * test: enable pubsub tests * fix: generate meaniful error when pubsub is called and not enabled * test: enable pubsub for factory daemon * fiix(pubsub-subscribe): stop HAPI gzip from buffering our streamed response * test: fix spec/pubsub * fix: lint errors * test: tests js/go pubsub interop * test: pubsub interop tests * test: more tests with different data types Note that binary data from JS to GO fails * HTTP API server: parsing query string as binary in pubsub publish * HTTP API: pubsub: publish should fail gracefully when no argument is given * chore: update deps * chore: update deps * last pass * chore: update deps * test: update interop tests * trying to fix cli pubsub tests * HTTP API server: pubsub pub buffer should have content * making linter happier * pubsub cli tests: higher timeout * making the linter even happier * tests: increasing some of the timeouts * fix: test was wrong * moar * mais um pouco * fix * meh * key size * moar timeouts * taaaaaaaaaaake ooooooonnn meeeeeeee * unomas * take it all * fix * moar * almost there * almost there part II * almost there part III * take out coverage from travis and pass it to circle * small adj in the travis config
fix red lights https://github.com/ipfs/js-ipfs/blob/master/test/cli/pubsub.js