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-bitswap
Commits
295cc213
Commit
295cc213
authored
Aug 20, 2019
by
Dirk McCormick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: fix flakey session peer manager ordering test
parent
da7f7eac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
sessionpeermanager/sessionpeermanager_test.go
sessionpeermanager/sessionpeermanager_test.go
+5
-5
No files found.
sessionpeermanager/sessionpeermanager_test.go
View file @
295cc213
...
...
@@ -166,7 +166,7 @@ func TestOrderingPeers(t *testing.T) {
case
<-
ctx
.
Done
()
:
t
.
Fatal
(
"Did not finish finding providers"
)
}
time
.
Sleep
(
2
*
time
.
Millisecond
)
time
.
Sleep
(
2
0
*
time
.
Millisecond
)
// record broadcast
sessionPeerManager
.
RecordPeerRequests
(
nil
,
c
)
...
...
@@ -176,11 +176,11 @@ func TestOrderingPeers(t *testing.T) {
peer1
:=
peers
[
randi
[
0
]]
peer2
:=
peers
[
randi
[
1
]]
peer3
:=
peers
[
randi
[
2
]]
time
.
Sleep
(
1
*
time
.
Millisecond
)
time
.
Sleep
(
1
0
*
time
.
Millisecond
)
sessionPeerManager
.
RecordPeerResponse
(
peer1
,
[]
cid
.
Cid
{
c
[
0
]})
time
.
Sleep
(
5
*
time
.
Millisecond
)
time
.
Sleep
(
5
0
*
time
.
Millisecond
)
sessionPeerManager
.
RecordPeerResponse
(
peer2
,
[]
cid
.
Cid
{
c
[
0
]})
time
.
Sleep
(
1
*
time
.
Millisecond
)
time
.
Sleep
(
1
0
*
time
.
Millisecond
)
sessionPeerManager
.
RecordPeerResponse
(
peer3
,
[]
cid
.
Cid
{
c
[
0
]})
sessionPeers
:=
sessionPeerManager
.
GetOptimizedPeers
()
...
...
@@ -228,7 +228,7 @@ func TestOrderingPeers(t *testing.T) {
// should sort by average latency
if
(
nextSessionPeers
[
0
]
.
Peer
!=
peer1
)
||
(
nextSessionPeers
[
1
]
.
Peer
!=
peer3
)
||
(
nextSessionPeers
[
2
]
.
Peer
!=
peer2
)
{
t
.
Fatal
(
"Did not
dedup peers which received multiple blocks
"
)
t
.
Fatal
(
"Did not
correctly update order of peers sorted by average latency
"
)
}
// should randomize other peers
...
...
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