From c044d9c32e507b4666de74a3048eecd33b3dc62a Mon Sep 17 00:00:00 2001 From: Jeromy Date: Tue, 23 Sep 2014 14:08:37 -0700 Subject: [PATCH] move mock routing tests to proper directory --- routing/mock/routing.go | 2 +- .../testnet => routing/mock}/routing_test.go | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) rename {exchange/bitswap/testnet => routing/mock}/routing_test.go (93%) diff --git a/routing/mock/routing.go b/routing/mock/routing.go index 43aecf269..e5fdb96fc 100644 --- a/routing/mock/routing.go +++ b/routing/mock/routing.go @@ -1,4 +1,4 @@ -package mockrouter +package mock import ( "errors" diff --git a/exchange/bitswap/testnet/routing_test.go b/routing/mock/routing_test.go similarity index 93% rename from exchange/bitswap/testnet/routing_test.go rename to routing/mock/routing_test.go index b3cbd385a..650f5d3d5 100644 --- a/exchange/bitswap/testnet/routing_test.go +++ b/routing/mock/routing_test.go @@ -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")