-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix bootstrapping bug and add real test for bootstrapping #2210
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright (c) 2016 Jeromy Johnson | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i stopped and admired the fact that the script i copied this from was 2014. I had to bump it two years forward There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
# MIT Licensed; see the LICENSE file in this repository. | ||
# | ||
|
||
# changing the bootstrap peers will require changing it in two places :) | ||
test_description="test node bootstrapping" | ||
|
||
. lib/test-lib.sh | ||
|
||
test_init_ipfs | ||
|
||
test_expect_success "disable mdns" ' | ||
ipfs config Discovery.MDNS.Enabled false --json | ||
' | ||
|
||
test_launch_ipfs_daemon | ||
|
||
export IPTB_ROOT="`pwd`/.iptb" | ||
|
||
ipfsi() { | ||
dir="$1" | ||
shift | ||
IPFS_PATH="$IPTB_ROOT/$dir" ipfs $@ | ||
} | ||
|
||
check_has_connection() { | ||
node=$1 | ||
ipfsi $node swarm peers | grep ipfs > /dev/null | ||
} | ||
|
||
test_expect_success "setup iptb nodes" ' | ||
iptb init -n 5 -f --bootstrap=none --port=0 | ||
' | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's try this here: test_expect_success "start up iptb nodes" '
iptb start --wait
'
test_expect_success "check peers works" '
ipfs swarm peers >peers_out
'
test_expect_success "correct number of peers" '
test_empty $(cat peers_out)
' There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is that better? |
||
test_expect_success "set bootstrap addrs" ' | ||
bsn_peer_id=$(ipfs id -f "<id>") && | ||
BADDR="/ip4/127.0.0.1/tcp/$PORT_SWARM/ipfs/$bsn_peer_id" && | ||
ipfsi 0 bootstrap add $BADDR && | ||
ipfsi 1 bootstrap add $BADDR && | ||
ipfsi 2 bootstrap add $BADDR && | ||
ipfsi 3 bootstrap add $BADDR && | ||
ipfsi 4 bootstrap add $BADDR | ||
' | ||
|
||
test_expect_success "start up iptb nodes" ' | ||
iptb start --wait | ||
' | ||
|
||
test_expect_success "check peers works" ' | ||
ipfs swarm peers > peers_out | ||
' | ||
|
||
test_expect_success "correct number of peers" ' | ||
test `cat peers_out | wc -l` == 5 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
' | ||
|
||
test_kill_ipfs_daemon | ||
|
||
test_expect_success "bring down iptb nodes" ' | ||
iptb stop | ||
' | ||
|
||
test_done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where do you make use of the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i only see
return peers, nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh whoops... I was using the
iaddr.ParseMultiaddr
to parse the/ipfs/Qmasdasd
part off of the addresses, then i realized that was already being done for me.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also https://travis-ci.org/ipfs/go-ipfs/jobs/102864391#L183