Commit 39d0b335 authored by Jeromy's avatar Jeromy

address CR feedback

License: MIT
Signed-off-by: default avatarJeromy <jeromyj@gmail.com>
parent 52da1e32
......@@ -201,7 +201,7 @@ func bootstrapConnect(ctx context.Context, ph host.Host, peers []peer.PeerInfo)
return nil
}
func toPeerInfos(bpeers []config.BootstrapPeer) ([]peer.PeerInfo, error) {
func toPeerInfos(bpeers []config.BootstrapPeer) []peer.PeerInfo {
pinfos := make(map[peer.ID]*peer.PeerInfo)
for _, bootstrap := range bpeers {
pinfo, ok := pinfos[bootstrap.ID()]
......@@ -219,7 +219,7 @@ func toPeerInfos(bpeers []config.BootstrapPeer) ([]peer.PeerInfo, error) {
peers = append(peers, *pinfo)
}
return peers, nil
return peers
}
func randomSubsetOfPeers(in []peer.PeerInfo, max int) []peer.PeerInfo {
......
......@@ -468,7 +468,7 @@ func (n *IpfsNode) loadBootstrapPeers() ([]peer.PeerInfo, error) {
if err != nil {
return nil, err
}
return toPeerInfos(parsed)
return toPeerInfos(parsed), nil
}
func (n *IpfsNode) loadFilesRoot() error {
......
......@@ -34,6 +34,41 @@ test_expect_success "setup iptb nodes" '
iptb init -n 5 -f --bootstrap=none --port=0
'
test_expect_success "start up iptb nodes" '
iptb start
'
test_expect_success "check peers works" '
ipfs swarm peers >peers_out
'
test_expect_success "correct number of peers" '
test -z "`cat peers_out`"
'
betterwait() {
while kill -0 $1; do true; done
}
test_expect_success "bring down iptb nodes" '
PID0=$(cat "$IPTB_ROOT/0/daemon.pid") &&
PID1=$(cat "$IPTB_ROOT/1/daemon.pid") &&
PID2=$(cat "$IPTB_ROOT/2/daemon.pid") &&
PID3=$(cat "$IPTB_ROOT/3/daemon.pid") &&
PID4=$(cat "$IPTB_ROOT/4/daemon.pid") &&
iptb stop && # TODO: add --wait flag to iptb stop
betterwait $PID0
betterwait $PID1
betterwait $PID2
betterwait $PID3
betterwait $PID4
'
test_expect_success "reset iptb nodes" '
# the api doesnt seem to get cleaned up in sharness tests for some reason
iptb init -n 5 -f --bootstrap=none --port=0
'
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" &&
......@@ -53,7 +88,7 @@ test_expect_success "check peers works" '
'
test_expect_success "correct number of peers" '
test `cat peers_out | wc -l` == 5
test `cat peers_out | wc -l` = 5
'
test_kill_ipfs_daemon
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment