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
7b4222ac
Commit
7b4222ac
authored
Sep 23, 2014
by
Jeromy
Committed by
Brian Tiger Chow
Sep 23, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change back to using Client method
parent
616f7760
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
12 deletions
+8
-12
bitswap_test.go
bitswap_test.go
+1
-2
testnet/routing.go
testnet/routing.go
+0
-1
testnet/routing_test.go
testnet/routing_test.go
+7
-9
No files found.
bitswap_test.go
View file @
7b4222ac
...
...
@@ -281,8 +281,7 @@ func session(net tn.Network, rs mock.RoutingServer, id peer.ID) instance {
p
:=
&
peer
.
Peer
{
ID
:
id
}
adapter
:=
net
.
Adapter
(
p
)
htc
:=
mock
.
NewMockRouter
(
p
,
nil
)
htc
.
SetRoutingServer
(
rs
)
htc
:=
rs
.
Client
(
p
)
blockstore
:=
bstore
.
NewBlockstore
(
ds
.
NewMapDatastore
())
const
alwaysSendToPeer
=
true
...
...
testnet/routing.go
deleted
100644 → 0
View file @
616f7760
package
bitswap
testnet/routing_test.go
View file @
7b4222ac
...
...
@@ -43,12 +43,10 @@ func TestSetAndGet(t *testing.T) {
}
func
TestClientFindProviders
(
t
*
testing
.
T
)
{
peer
:=
&
peer
.
Peer
{
ID
:
[]
byte
(
"42"
),
}
peer
:=
&
peer
.
Peer
{
ID
:
[]
byte
(
"42"
)}
rs
:=
mock
.
VirtualRoutingServer
()
client
:=
mock
.
NewMockRouter
(
peer
,
nil
)
client
.
SetRoutingServer
(
rs
)
client
:=
rs
.
Client
(
peer
)
k
:=
u
.
Key
(
"hello"
)
err
:=
client
.
Provide
(
context
.
Background
(),
k
)
if
err
!=
nil
{
...
...
@@ -99,8 +97,9 @@ func TestClientOverMax(t *testing.T) {
}
max
:=
10
client
:=
mock
.
NewMockRouter
(
&
peer
.
Peer
{
ID
:
[]
byte
(
"TODO"
)},
nil
)
client
.
SetRoutingServer
(
rs
)
peer
:=
&
peer
.
Peer
{
ID
:
[]
byte
(
"TODO"
)}
client
:=
rs
.
Client
(
peer
)
providersFromClient
:=
client
.
FindProvidersAsync
(
context
.
Background
(),
k
,
max
)
i
:=
0
for
_
=
range
providersFromClient
{
...
...
@@ -132,8 +131,7 @@ func TestCanceledContext(t *testing.T) {
}()
local
:=
&
peer
.
Peer
{
ID
:
[]
byte
(
"peer id doesn't matter"
)}
client
:=
mock
.
NewMockRouter
(
local
,
nil
)
client
.
SetRoutingServer
(
rs
)
client
:=
rs
.
Client
(
local
)
t
.
Log
(
"warning: max is finite so this test is non-deterministic"
)
t
.
Log
(
"context cancellation could simply take lower priority"
)
...
...
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