Skip to content
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

torresashjian
Copy link
Contributor

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

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>
Copy link
Member

@whyrusleeping whyrusleeping left a comment

Choose a reason for hiding this comment

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

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()
Copy link
Member

Choose a reason for hiding this comment

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

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

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

@whyrusleeping whyrusleeping left a comment

Choose a reason for hiding this comment

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

Thanks!

@whyrusleeping whyrusleeping merged commit 77c5f56 into ipfs:master Jun 10, 2017
@whyrusleeping whyrusleeping added this to the Ipfs 0.4.10 milestone Jun 10, 2017
@torresashjian torresashjian deleted the fix/cmds/dht-findprovs-num branch June 12, 2017 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants