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
c044d9c3
Commit
c044d9c3
authored
Sep 23, 2014
by
Jeromy
Committed by
Brian Tiger Chow
Sep 23, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move mock routing tests to proper directory
parent
414ff341
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
routing/mock/routing.go
routing/mock/routing.go
+1
-1
routing/mock/routing_test.go
routing/mock/routing_test.go
+6
-7
No files found.
routing/mock/routing.go
View file @
c044d9c3
package
mock
router
package
mock
import
(
"errors"
...
...
exchange/bitswap/testnet
/routing_test.go
→
routing/mock
/routing_test.go
View file @
c044d9c3
package
bitswap
package
mock
import
(
"bytes"
...
...
@@ -6,13 +6,12 @@ import (
context
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
"github.com/jbenet/go-ipfs/peer"
mock
"github.com/jbenet/go-ipfs/routing/mock"
u
"github.com/jbenet/go-ipfs/util"
)
func
TestKeyNotFound
(
t
*
testing
.
T
)
{
vrs
:=
mock
.
VirtualRoutingServer
()
vrs
:=
VirtualRoutingServer
()
empty
:=
vrs
.
Providers
(
u
.
Key
(
"not there"
))
if
len
(
empty
)
!=
0
{
t
.
Fatal
(
"should be empty"
)
...
...
@@ -25,7 +24,7 @@ func TestSetAndGet(t *testing.T) {
ID
:
pid
,
}
k
:=
u
.
Key
(
"42"
)
rs
:=
mock
.
VirtualRoutingServer
()
rs
:=
VirtualRoutingServer
()
err
:=
rs
.
Announce
(
p
,
k
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -44,7 +43,7 @@ func TestSetAndGet(t *testing.T) {
func
TestClientFindProviders
(
t
*
testing
.
T
)
{
peer
:=
&
peer
.
Peer
{
ID
:
[]
byte
(
"42"
)}
rs
:=
mock
.
VirtualRoutingServer
()
rs
:=
VirtualRoutingServer
()
client
:=
rs
.
Client
(
peer
)
k
:=
u
.
Key
(
"hello"
)
...
...
@@ -78,7 +77,7 @@ func TestClientFindProviders(t *testing.T) {
}
func
TestClientOverMax
(
t
*
testing
.
T
)
{
rs
:=
mock
.
VirtualRoutingServer
()
rs
:=
VirtualRoutingServer
()
k
:=
u
.
Key
(
"hello"
)
numProvidersForHelloKey
:=
100
for
i
:=
0
;
i
<
numProvidersForHelloKey
;
i
++
{
...
...
@@ -112,7 +111,7 @@ func TestClientOverMax(t *testing.T) {
// TODO does dht ensure won't receive self as a provider? probably not.
func
TestCanceledContext
(
t
*
testing
.
T
)
{
rs
:=
mock
.
VirtualRoutingServer
()
rs
:=
VirtualRoutingServer
()
k
:=
u
.
Key
(
"hello"
)
t
.
Log
(
"async'ly announce infinite stream of providers for key"
)
...
...
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