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

unix-friendly output for 'ipfs dht' commands #2560

Merged
merged 21 commits into from
Apr 27, 2016

Conversation

hackergrrl
Copy link
Contributor

addresses #2494

@whyrusleeping
Copy link
Member

Could you add some sharness tests using iptb for these now? Now that the output is relatively friendly, thats a much easier task.

@hackergrrl
Copy link
Contributor Author

cc @RichardLitt

@hackergrrl
Copy link
Contributor Author

hackergrrl commented Apr 19, 2016

@whyrusleeping I'm starting to look at this, but given my understanding of DHTs, tests are going to be very fragile: they're highly timing dependent (read: sleep and crossing our fingers). Checking here to see if you know something I don't about making these deterministic.

@whyrusleeping
Copy link
Member

they shouldnt be too fragile. I'd go for at least testing findprovs first. Add something on one node, run a findprovs from another and make sure that node shows up.

@hackergrrl
Copy link
Contributor Author

You were right: fragility wasn't a problem here. I guess we're good about setting up DHT population on init + local machine sockets -- awesome!

@hackergrrl
Copy link
Contributor Author

Finally passing! I don't think it liked me running iptb init with --force.

@RichardLitt
Copy link
Member

!remindme when merged.

GetValue will return the value stored in the DHT at the given key.
Outputs the best value for the given key.

There may be several different values for a given key stored in the DHT, so this context 'best' means the record that is most desirable. There is no one metric for 'best': it depends entirely on the key type. For IPNS, 'best' is the record that is both valid and has the highest sequence number (freshest). Different key types can specify other 'best' rules.
Copy link
Member

Choose a reason for hiding this comment

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

...so in this context...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch!

@RichardLitt
Copy link
Member

@noffle Changes look good, but there's an errant ' and ) now.

@hackergrrl
Copy link
Contributor Author

I see the extra ) but no apostrophe issues. The one on go-ipfs' is intentional (possessive).

@RichardLitt
Copy link
Member

I would avoid the possessive apostrophe here, a bit confusing. go-ipfs DHT internals works as a compound noun without it.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
@hackergrrl
Copy link
Contributor Author

Removed.

# ipfs dht findprovs <key>
test_expect_success 'findprovs' '
ipfsi 4 dht findprovs planet >actual &&
PEERS=$(wc -l actual | cut -d '"'"' '"'"' -f 1) &&
Copy link
Member

Choose a reason for hiding this comment

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

should check the output here is what we expect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
@whyrusleeping
Copy link
Member

new tests seem to be failing

RichardLitt and others added 2 commits April 25, 2016 09:27
License: MIT
Signed-off-by: Richard Littauer <richard.littauer@gmail.com>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
@hackergrrl
Copy link
Contributor Author

Got it. foo >expected | sort != foo | sort >expected. 😀

@whyrusleeping whyrusleeping merged commit 5d25fc1 into ipfs:master Apr 27, 2016
hackergrrl pushed a commit to hackergrrl/go-ipfs that referenced this pull request Apr 28, 2016
* Cleans up 'ipfs dht findpeer' output

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Adds more docs for 'ipfs dht put'.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Write pretty peer ids for ipfs dht put.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Writes pretty peer ids for ipfs dht query.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Suppresses unrecognized event type for FinalPeer.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Improves helptext on dht commands.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Adds 'ipfs dht findpeer' sharness test.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Adds sharness tests for remaining DHT commands.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Uses bash tests rather than 'test' command.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Removes commented code.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Removes unneeded init_ipfs.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Tweaks iptb setup.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Tweaks wording on dht 'put' and 'get'.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Removes extraneous ).

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Removes apostrophe.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Tests the expected peer addresses.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Gets peer id using iptb.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Checks explicitly for common put/findprovs peers.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Sorts expected/actual findpeer results.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Fix disconnect argument description

License: MIT
Signed-off-by: Richard Littauer <richard.littauer@gmail.com>

* Fixes sort order in t0170-dht.sh.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
hackergrrl pushed a commit to hackergrrl/go-ipfs that referenced this pull request Apr 28, 2016
* Cleans up 'ipfs dht findpeer' output

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Adds more docs for 'ipfs dht put'.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Write pretty peer ids for ipfs dht put.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Writes pretty peer ids for ipfs dht query.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Suppresses unrecognized event type for FinalPeer.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Improves helptext on dht commands.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Adds 'ipfs dht findpeer' sharness test.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Adds sharness tests for remaining DHT commands.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Uses bash tests rather than 'test' command.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Removes commented code.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Removes unneeded init_ipfs.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Tweaks iptb setup.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Tweaks wording on dht 'put' and 'get'.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Removes extraneous ).

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Removes apostrophe.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Tests the expected peer addresses.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Gets peer id using iptb.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Checks explicitly for common put/findprovs peers.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Sorts expected/actual findpeer results.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

* Fix disconnect argument description

License: MIT
Signed-off-by: Richard Littauer <richard.littauer@gmail.com>

* Fixes sort order in t0170-dht.sh.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
@RichardLitt
Copy link
Member

Thanks for this!

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.

3 participants