From a467d5081ceedc4f2659987438d7e9a0dcddf079 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 1 Sep 2012 13:17:30 -0700 Subject: [PATCH] adjusted tests --- weed-fs/src/pkg/topology/topo_test.go | 6 ++---- weed-fs/src/pkg/topology/topology.go | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/weed-fs/src/pkg/topology/topo_test.go b/weed-fs/src/pkg/topology/topo_test.go index 928454791..5bbc33dd9 100644 --- a/weed-fs/src/pkg/topology/topo_test.go +++ b/weed-fs/src/pkg/topology/topo_test.go @@ -161,11 +161,9 @@ func TestRemoveDataCenter(t *testing.T) { func TestReserveOneVolume(t *testing.T) { topo := setup() rand.Seed(time.Now().UnixNano()) - ret, vid := topo.RandomlyReserveOneVolume() + ret, node, vid := topo.RandomlyReserveOneVolume() fmt.Println("topology:", topo.Node) fmt.Println("assigned :", ret) + fmt.Println("assigned node :", node) fmt.Println("assigned volume id:", vid) - if topo.reservedVolumeCount != 1 { - t.Fail() - } } diff --git a/weed-fs/src/pkg/topology/topology.go b/weed-fs/src/pkg/topology/topology.go index ce313dc7b..79f0fac67 100644 --- a/weed-fs/src/pkg/topology/topology.go +++ b/weed-fs/src/pkg/topology/topology.go @@ -3,7 +3,7 @@ package topology import ( "math/rand" "pkg/storage" - "fmt" + _ "fmt" ) type Topology struct { @@ -19,7 +19,6 @@ func NewTopology(id NodeId) *Topology{ func (t *Topology) RandomlyReserveOneVolume() (bool, *Node, storage.VolumeId) { slots := t.Node.maxVolumeCount-t.Node.activeVolumeCount r := rand.Intn(slots) - fmt.Println("slots:", slots, "random :", r) vid := t.nextVolumeId() ret, node := t.Node.ReserveOneVolume(r,vid) return ret, node, vid