Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(768)

Unified Diff: agent/mongo/mongo_test.go

Issue 83130045: worker/peergrouper: use mongo.SelectPeerHostPort
Patch Set: worker/peergrouper: use mongo.SelectPeerHostPort Created 9 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « agent/mongo/mongo.go ('k') | worker/peergrouper/worker.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « agent/mongo/mongo.go ('k') | worker/peergrouper/worker.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b