New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'ipfs dht findprovs --num-providers' to allow choosing number of providers to find #3966

Merged
merged 2 commits into from Jun 10, 2017

Conversation

Projects
None yet
2 participants
@torresashjian
Copy link
Contributor

torresashjian commented Jun 10, 2017

Closes: #3839

I was looking for ways to add tests to findProviders command when new option --num-providers is given. But could not find a good example on existing commands to test options.

One possibility is to use a mocking library to mock the Node, but I didn't want to introduce new library dependencies for such a trivial change.

Please advice if new tests are needed.

License: MIT
Signed-off-by: Miguel Torres migueltorreslopez@gmail.com

Add option to choose a specific number of providers to search for
License: MIT
Signed-off-by: Miguel Torres <migueltorreslopez@gmail.com>

Apply fmt

License: MIT
Signed-off-by: Miguel Torres <migueltorreslopez@gmail.com>

Add format

License: MIT
Signed-off-by: Miguel Torres <migueltorreslopez@gmail.com>
@whyrusleeping
Copy link
Member

whyrusleeping left a comment

One small nitpick, then LGTM. Thanks for this!

@@ -159,7 +160,15 @@ var findProvidersDhtCmd = &cmds.Command{
return
}

numProviders := 20
numProviders, _, err := res.Request().Option("n").Int()

This comment has been minimized.

@whyrusleeping

whyrusleeping Jun 10, 2017

Member

nitpick: would prefer using the long option name for the lookup here

Use long name for option lookup
License: MIT
Signed-off-by: Miguel Torres <migueltorreslopez@gmail.com>
@whyrusleeping
Copy link
Member

whyrusleeping left a comment

Thanks!

@whyrusleeping whyrusleeping merged commit 77c5f56 into ipfs:master Jun 10, 2017

3 of 5 checks passed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
ci/circleci A command timed out during your tests
Details
codeclimate no new or fixed issues
Details
commit-message-check/gitcop All commit messages are valid
Details
continuous-integration/jenkins/pr-merge This commit looks good
Details

@whyrusleeping whyrusleeping added this to the Ipfs 0.4.10 milestone Jun 10, 2017

@torresashjian torresashjian deleted the torresashjian:fix/cmds/dht-findprovs-num branch Jun 12, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment