Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kubo_final
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anastasiia Chirikova
kubo_final
Commits
39d0b335
Commit
39d0b335
authored
9 years ago
by
Jeromy Johnson
Browse files
Options
Downloads
Patches
Plain Diff
address CR feedback
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
52da1e32
No related branches found
No related tags found
1 merge request
!1
New
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
core/bootstrap.go
+2
-2
2 additions, 2 deletions
core/bootstrap.go
core/core.go
+1
-1
1 addition, 1 deletion
core/core.go
test/sharness/t0121-bootstrap-iptb.sh
+36
-1
36 additions, 1 deletion
test/sharness/t0121-bootstrap-iptb.sh
with
39 additions
and
4 deletions
core/bootstrap.go
+
2
−
2
View file @
39d0b335
...
...
@@ -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
{
...
...
This diff is collapsed.
Click to expand it.
core/core.go
+
1
−
1
View file @
39d0b335
...
...
@@ -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
{
...
...
This diff is collapsed.
Click to expand it.
test/sharness/t0121-bootstrap-iptb.sh
+
36
−
1
View file @
39d0b335
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment