-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix ping tests #1685
fix ping tests #1685
Conversation
expect(res.result.Strings).to.be.eql([]) | ||
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.
This test was no longer valid. I've checked go-ipfs and now it is indeed supposed for IPFS to return the list of peers we are pubsub'ing with when no topic is provided.
Seems there are still some more issues on ping :( |
@@ -27,7 +27,8 @@ module.exports = function pingPullStream (self) { | |||
if (err) { | |||
log.error(err) | |||
source.push(getPacket({ success: false, text: err.toString() })) | |||
source.end(err) | |||
source.push(err) | |||
source.end() |
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.
This made the tests pass but I'm not 100% convinced this is exactly what we want.
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.
We need to differentiate between a real failure (invalid peer ID) and unavailable.
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've separated the getPeer from the runPing steps
After debugging a bit more, I really think the problem is with the tests themselves. https://github.com/ipfs/interface-ipfs-core/blob/master/js/src/ping/ping.js#L58-L64 seems to be an antipattern to me. We can't expect to have error and results all at the same time. |
Now I also understand why people were reporting that Ping was not working because DHT is not available:
It should instead say, that it couldn't find the Peer. Error from go-ipfs
|
Almost there. last mile is figuring out while the error doesn't propagate to the tests when using core directly (ipfs-api over http-api is fine)
|
@@ -23,9 +24,19 @@ exports.get = { | |||
handler: (request, reply) => { |
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.
@alanshaw @hugomrdias @achingbrain et al, can I get your eyes to go through this handler. This stream tagliatelle is a nightmare came true.
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.
Stream tagliatelle - I’m going to use that one
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.
Buffering isn’t ideal but it’ll do for now!
For #1684