Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
f8c523fc
Commit
f8c523fc
authored
Dec 23, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bootstrap test
parent
cdb461d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
4 deletions
+44
-4
routing/dht/dht_test.go
routing/dht/dht_test.go
+44
-4
No files found.
routing/dht/dht_test.go
View file @
f8c523fc
...
...
@@ -91,6 +91,18 @@ func connect(t *testing.T, ctx context.Context, a, b *IpfsDHT) {
}
}
func
bootstrap
(
t
*
testing
.
T
,
ctx
context
.
Context
,
dhts
[]
*
IpfsDHT
)
{
var
wg
sync
.
WaitGroup
for
_
,
dht
:=
range
dhts
{
wg
.
Add
(
1
)
go
func
()
{
defer
wg
.
Done
()
dht
.
Bootstrap
(
ctx
)
}()
}
wg
.
Wait
()
}
func
TestPing
(
t
*
testing
.
T
)
{
// t.Skip("skipping test to debug another")
ctx
:=
context
.
Background
()
...
...
@@ -235,8 +247,38 @@ func TestProvides(t *testing.T) {
}
}
func
TestBootstrap
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
nDHTs
:=
40
_
,
_
,
dhts
:=
setupDHTS
(
ctx
,
nDHTs
,
t
)
defer
func
()
{
for
i
:=
0
;
i
<
nDHTs
;
i
++
{
dhts
[
i
]
.
Close
()
defer
dhts
[
i
]
.
network
.
Close
()
}
}()
t
.
Logf
(
"connecting %d dhts in a ring"
,
nDHTs
)
for
i
:=
0
;
i
<
nDHTs
;
i
++
{
connect
(
t
,
ctx
,
dhts
[
i
],
dhts
[(
i
+
1
)
%
len
(
dhts
)])
}
t
.
Logf
(
"bootstrapping them so they find each other"
,
nDHTs
)
bootstrap
(
t
,
ctx
,
dhts
)
// the routing tables should be full now. let's inspect them.
t
.
Logf
(
"checking routing table of %d"
,
nDHTs
)
for
_
,
dht
:=
range
dhts
{
fmt
.
Printf
(
"checking routing table of %s
\n
"
,
dht
.
self
)
dht
.
routingTable
.
Print
()
fmt
.
Println
(
""
)
}
}
func
TestProvidesMany
(
t
*
testing
.
T
)
{
t
.
Skip
(
"this test doesn't work"
)
// t.Skip("skipping test to debug another")
ctx
:=
context
.
Background
()
nDHTs
:=
40
...
...
@@ -253,10 +295,8 @@ func TestProvidesMany(t *testing.T) {
connect
(
t
,
ctx
,
dhts
[
i
],
dhts
[(
i
+
1
)
%
len
(
dhts
)])
}
// t.Logf("bootstrapping them so they find each other", nDHTs)
// for _, dht := range dhts {
// bootstrap(t, ctx, dht)
// }
t
.
Logf
(
"bootstrapping them so they find each other"
,
nDHTs
)
bootstrap
(
t
,
ctx
,
dhts
)
d
:=
0
for
k
,
v
:=
range
testCaseValues
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment