Index: agent/mongo/mongo_test.go |
=== modified file 'agent/mongo/mongo_test.go' |
--- agent/mongo/mongo_test.go 2014-04-01 08:19:52 +0000 |
+++ agent/mongo/mongo_test.go 2014-04-02 16:14:25 +0000 |
@@ -144,23 +144,40 @@ |
} |
func (s *MongoSuite) TestSelectPeerAddress(c *gc.C) { |
- addresses := []instance.Address{ |
- { |
+ addresses := []instance.Address{{ |
+ Value: "10.0.0.1", |
+ Type: instance.Ipv4Address, |
+ NetworkName: "cloud", |
+ NetworkScope: instance.NetworkCloudLocal}, { |
+ Value: "8.8.8.8", |
+ Type: instance.Ipv4Address, |
+ NetworkName: "public", |
+ NetworkScope: instance.NetworkPublic}} |
+ |
+ address := SelectPeerAddress(addresses) |
+ c.Assert(address, gc.Equals, "10.0.0.1") |
+} |
+ |
+func (s *MongoSuite) TestSelectPeerHostPort(c *gc.C) { |
+ |
+ hostPorts := []instance.HostPort{{ |
+ Address: instance.Address{ |
Value: "10.0.0.1", |
Type: instance.Ipv4Address, |
NetworkName: "cloud", |
NetworkScope: instance.NetworkCloudLocal, |
}, |
- { |
+ Port: 37017}, { |
+ Address: instance.Address{ |
Value: "8.8.8.8", |
Type: instance.Ipv4Address, |
NetworkName: "public", |
NetworkScope: instance.NetworkPublic, |
}, |
- } |
+ Port: 37017}} |
- address := SelectPeerAddress(addresses) |
- c.Assert(address, gc.Equals, "10.0.0.1") |
+ address := SelectPeerHostPort(hostPorts) |
+ c.Assert(address, gc.Equals, "10.0.0.1:37017") |
} |
func (s *MongoSuite) TestMongoPackageForSeries(c *gc.C) { |