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
p2p
go-p2p-kad-dht
Commits
11776e03
Commit
11776e03
authored
Feb 01, 2020
by
Adin Schmahmann
Committed by
Steven Allen
Apr 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: switch tests to use dht.bucketSize instead of KValue for queries
parent
19e4d2ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
dht_test.go
dht_test.go
+5
-4
No files found.
dht_test.go
View file @
11776e03
...
...
@@ -1494,7 +1494,7 @@ func testFindPeerQuery(t *testing.T,
sort
.
Sort
(
peer
.
IDSlice
(
outpeers
))
exp := kb.SortClosestPeers(reachableIds, rtval)[:minInt(
KValu
e, len(reachableIds))]
exp
:=
kb
.
SortClosestPeers
(
reachableIds
,
rtval
)[
:
minInt
(
guy
.
bucketSiz
e
,
len
(
reachableIds
))]
t
.
Logf
(
"got %d peers"
,
len
(
outpeers
))
got
:=
kb
.
SortClosestPeers
(
outpeers
,
rtval
)
...
...
@@ -1519,7 +1519,8 @@ func TestFindClosestPeers(t *testing.T) {
connect
(
t
,
ctx
,
dhts
[
i
],
dhts
[(
i
+
1
)
%
len
(
dhts
)])
}
peers, err := dhts[1].GetClosestPeers(ctx, "foo")
querier
:=
dhts
[
1
]
peers
,
err
:=
querier
.
GetClosestPeers
(
ctx
,
"foo"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
@@ -1529,8 +1530,8 @@ func TestFindClosestPeers(t *testing.T) {
out
=
append
(
out
,
p
)
}
if len(out) !=
KValu
e {
t.Fatalf("got wrong number of peers (got %d, expected %d)", len(out),
KValu
e)
if
len
(
out
)
!=
querier
.
bucketSiz
e
{
t
.
Fatalf
(
"got wrong number of peers (got %d, expected %d)"
,
len
(
out
),
querier
.
bucketSiz
e
)
}
}
...
...
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