-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(cli): make swarm addrs more resilient #2083
Conversation
Dont fail if decapsulation of ipfs fails. Go node addresses typically wont contain their peerid
Nice! Please can we have a test? |
@alanshaw sure, do you have a recommendation for testing the cli, it's been a while. I don't believe I can change addresses on the node via the api, so the options I can think of would be to add a go node to the test suite (this feels like it should go an interop though), or just mock and test the cli handler directly. |
This please 😁 |
I added a test for the cli handler. Since it's verifying process.stdout, the test cleanup isn't as clean as I'd like. If we just use the afterEach hook we'll lost the mocha output. We could stub the print function, but that would require a change to how it's being used in the cli file in order for the stub to work. If we planned on adding more cli tests that just target the handlers directly (which would make cli tests much faster) we could build out some utilities to make the individual tests easier/cleaner to write. |
@jacobheun if you change the handler to build up a string for the output and then return it it'll get printed automatically. It might save you from having to stub In the future we might want to think about passing |
Ah, perfect! I updated the tests to check the returned output. I think testing the output returned from the handler is great. Then we only need to verify that bin is calling print appropriately. Here is some truncated output running locally against an 0.36 rc daemon:
|
Yeah it works for small non-streaming APIs, but print is still needed for commands like |
Dont fail if decapsulation of ipfs fails. Go node addresses typically wont contain their peerid
Fixes #1575