Blob Blame History Raw
From b6b96f4ddea7a83603e46fd6d512c13e7be45b40 Mon Sep 17 00:00:00 2001
From: Jan Chaloupka <jchaloup@redhat.com>
Date: Tue, 27 Oct 2015 17:53:45 +0100
Subject: [PATCH] change default ports

---
 etcd/client.go      | 2 +-
 etcd/client_test.go | 8 ++++----
 etcd/cluster.go     | 4 ++--
 etcd/member_test.go | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/etcd/client.go b/etcd/client.go
index 60ed762..d0869e8 100644
--- a/etcd/client.go
+++ b/etcd/client.go
@@ -95,7 +95,7 @@ func NewClient(machines []string) *Client {
 func NewTLSClient(machines []string, cert, key, caCert string) (*Client, error) {
 	// overwrite the default machine to use https
 	if len(machines) == 0 {
-		machines = []string{"https://127.0.0.1:4001"}
+		machines = []string{"https://127.0.0.1:2379"}
 	}
 
 	config := Config{
diff --git a/etcd/client_test.go b/etcd/client_test.go
index 4720d8d..052114e 100644
--- a/etcd/client_test.go
+++ b/etcd/client_test.go
@@ -10,13 +10,13 @@ import (
 )
 
 // To pass this test, we need to create a cluster of 3 machines
-// The server should be listening on localhost:4001, 4002, 4003
+// The server should be listening on localhost:2379, 4002, 4003
 func TestSync(t *testing.T) {
-	fmt.Println("Make sure there are three nodes at 0.0.0.0:4001-4003")
+	fmt.Println("Make sure there are three nodes at 0.0.0.0:2379-4003")
 
 	// Explicit trailing slash to ensure this doesn't reproduce:
 	// https://github.com/coreos/go-etcd/issues/82
-	c := NewClient([]string{"http://127.0.0.1:4001/"})
+	c := NewClient([]string{"http://127.0.0.1:2379/"})
 
 	success := c.SyncCluster()
 	if !success {
@@ -96,7 +96,7 @@ func TestPersistence(t *testing.T) {
 }
 
 func TestClientRetry(t *testing.T) {
-	c := NewClient([]string{"http://strange", "http://127.0.0.1:4001"})
+	c := NewClient([]string{"http://strange", "http://127.0.0.1:2379"})
 	// use first endpoint as the picked url
 	c.cluster.picked = 0
 	if _, err := c.Set("foo", "bar", 5); err != nil {
diff --git a/etcd/cluster.go b/etcd/cluster.go
index d0461e1..02ed577 100644
--- a/etcd/cluster.go
+++ b/etcd/cluster.go
@@ -14,9 +14,9 @@ type Cluster struct {
 }
 
 func NewCluster(machines []string) *Cluster {
-	// if an empty slice was sent in then just assume HTTP 4001 on localhost
+	// if an empty slice was sent in then just assume HTTP 2379 on localhost
 	if len(machines) == 0 {
-		machines = []string{"http://127.0.0.1:4001"}
+		machines = []string{"http://127.0.0.1:2379"}
 	}
 
 	machines = shuffleStringSlice(machines)
diff --git a/etcd/member_test.go b/etcd/member_test.go
index 53ebdd4..b3439a7 100644
--- a/etcd/member_test.go
+++ b/etcd/member_test.go
@@ -16,7 +16,7 @@ func TestMemberCollectionUnmarshal(t *testing.T) {
 			want: memberCollection([]Member{}),
 		},
 		{
-			body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
+			body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:2379"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
 			want: memberCollection(
 				[]Member{
 					{
@@ -38,7 +38,7 @@ func TestMemberCollectionUnmarshal(t *testing.T) {
 						},
 						ClientURLs: []string{
 							"http://127.0.0.1:2379",
-							"http://127.0.0.1:4001",
+							"http://127.0.0.1:2379",
 						},
 					},
 					{
-- 
1.9.3