Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

test: add tests and docs for ipfs.resolve #332

Merged
merged 5 commits into from
Aug 2, 2018
Merged

test: add tests and docs for ipfs.resolve #332

merged 5 commits into from
Aug 2, 2018

Conversation

alanshaw
Copy link
Contributor

@alanshaw alanshaw commented Jul 19, 2018

"should resolve IPNS link recursively" takes > 1min on my laptop. I'm open to suggestions on how to speed this up...

refs ipfs-inactive/js-ipfs-http-client#794 and ipfs/js-ipfs#1455

@ghost ghost assigned alanshaw Jul 19, 2018
@ghost ghost added the in progress label Jul 19, 2018
})

// Test resolve turns /ipns/domain.com into /ipfs/QmHash
it('should resolve an IPNS DNS link', function (done) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case is a bit worrisome. First we have the reliance on a remote service, secondly we're not actually checking if the output is correct.

My first thought is that in general for the ipns tests, we should have a mini-dns service running together with the tests, that the local daemon can resolve IPNS to. So instead of testing /ipns/ipfs.io we should test /ipns/local-dns-service.home which would be resolved only locally and we can then assert correct output.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like that too. I have no idea how to do that or if it's even possible but I'll look into it. Do you have any pointers?

@alanshaw
Copy link
Contributor Author

@victorbjelkholm I've added skips to the DNS related tests until we can find a good way to not depend on external DNS records.

I had an idea that for these tests the TXT record to lookup would be at the domain [cid].ipfs-test.local and we'd use an MDNS server to respond to the query. The server could look at the CID in the subdomain and would reply with dnslink=/ipfs/[cid].

I tried using https://www.npmjs.com/package/mdns-server for this but it wasn't able to bind to the MDNS ports. I'm guessing IPFS is already bound to them 😕?

Maybe we can setup Jenkins to run a DNS server with some known records?

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
@victorb
Copy link
Contributor

victorb commented Jul 20, 2018

I've added skips to the DNS related tests until we can find a good way to not depend on external DNS records.

Let's run them for now, if they become a problem we can skip them. Not relying on external DNS is a nice-to-have-feature and not required. We also already have bunch of other tests that are having a dependency on external DNS.

Maybe we can setup Jenkins to run a DNS server with some known records?

I rather not, as the tests would run different locally. Would be nicer to have some in-process dns server we can startup/shutdown together with the tests. Then we can also easier test what happens when records are changed etc etc.

Created a issue to track it here: https://github.com/ipfs/testing/issues/58

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
@alanshaw alanshaw requested a review from daviddias July 23, 2018 12:39
@alanshaw alanshaw merged commit f3081ab into master Aug 2, 2018
@ghost ghost removed the in progress label Aug 2, 2018
@alanshaw alanshaw deleted the test/resolve branch August 2, 2018 17:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants