1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-29 17:36:38 +08:00

move mock routing tests to proper directory

This commit is contained in:
Jeromy
2014-09-23 14:08:37 -07:00
committed by Brian Tiger Chow
parent 414ff34194
commit c044d9c32e
2 changed files with 7 additions and 8 deletions

View File

@ -1,4 +1,4 @@
package mockrouter
package mock
import (
"errors"

View File

@ -1,4 +1,4 @@
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")