@cryptotaxi247 / kubo / commits / c044d9c32

move mock routing tests to proper directory

Jeromy committed Sep 23, 2014 at 14:08 UTC c044d9c32e507b4666de74a3048eecd33b3dc62a
2 files changed +7 -8
routing/mock/routing.go
+1 -1
@@ -1,4 +1,4 @@
1 -package mockrouter
1 +package mock
2
3 import (
4 "errors"
routing/mock/routing_test.go renamed
+6 -7
@@ -1,4 +1,4 @@
1 -package bitswap
1 +package mock
2
3 import (
4 "bytes"
@@ -6,13 +6,12 @@ import (
6
7 context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
8 "github.com/jbenet/go-ipfs/peer"
9 - mock "github.com/jbenet/go-ipfs/routing/mock"
9 u "github.com/jbenet/go-ipfs/util"
10 )
11
12 func TestKeyNotFound(t *testing.T) {
13
15 - vrs := mock.VirtualRoutingServer()
14 + vrs := VirtualRoutingServer()
15 empty := vrs.Providers(u.Key("not there"))
16 if len(empty) != 0 {
17 t.Fatal("should be empty")
@@ -25,7 +24,7 @@ func TestSetAndGet(t *testing.T) {
24 ID: pid,
25 }
26 k := u.Key("42")
28 - rs := mock.VirtualRoutingServer()
27 + rs := VirtualRoutingServer()
28 err := rs.Announce(p, k)
29 if err != nil {
30 t.Fatal(err)
@@ -44,7 +43,7 @@ func TestSetAndGet(t *testing.T) {
43
44 func TestClientFindProviders(t *testing.T) {
45 peer := &peer.Peer{ID: []byte("42")}
47 - rs := mock.VirtualRoutingServer()
46 + rs := VirtualRoutingServer()
47 client := rs.Client(peer)
48
49 k := u.Key("hello")
@@ -78,7 +77,7 @@ func TestClientFindProviders(t *testing.T) {
77 }
78
79 func TestClientOverMax(t *testing.T) {
81 - rs := mock.VirtualRoutingServer()
80 + rs := VirtualRoutingServer()
81 k := u.Key("hello")
82 numProvidersForHelloKey := 100
83 for i := 0; i < numProvidersForHelloKey; i++ {
@@ -112,7 +111,7 @@ func TestClientOverMax(t *testing.T) {
111
112 // TODO does dht ensure won't receive self as a provider? probably not.
113 func TestCanceledContext(t *testing.T) {
115 - rs := mock.VirtualRoutingServer()
114 + rs := VirtualRoutingServer()
115 k := u.Key("hello")
116
117 t.Log("async'ly announce infinite stream of providers for key")