From e91377fa266166572afa59c64c447f0fd46fa6bf Mon Sep 17 00:00:00 2001 From: James Phillips Date: Mon, 20 Mar 2017 16:23:40 -0700 Subject: [PATCH] Cleans up based on review feedback. --- api/operator_area.go | 6 +++--- consul/server_test.go | 42 ++++++++++++++---------------------------- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/api/operator_area.go b/api/operator_area.go index ebd74832c9..bf4d2f8491 100644 --- a/api/operator_area.go +++ b/api/operator_area.go @@ -16,10 +16,10 @@ type Area struct { // when creating a new area. ID string - // PeeerDatacenter is the peer Consul datacenter that will make up the + // PeerDatacenter is the peer Consul datacenter that will make up the // other side of this network area. Network areas always involve a pair // of datacenters: the datacenter where the area was created, and the - // peer datacenter. This is required + // peer datacenter. This is required. PeerDatacenter string // RetryJoin specifies the address of Consul servers to join to, such as @@ -37,7 +37,7 @@ type AreaJoinResponse struct { Joined bool // If we couldn't join, this is the message with information. - What string + Error string } // SerfMember is a generic structure for reporting information about members in diff --git a/consul/server_test.go b/consul/server_test.go index 3971d3d023..84decf554d 100644 --- a/consul/server_test.go +++ b/consul/server_test.go @@ -241,17 +241,13 @@ func TestServer_JoinWAN_Flood(t *testing.T) { t.Fatalf("err: %v", err) } - testutil.WaitForResult(func() (bool, error) { - return len(s1.WANMembers()) == 2, nil - }, func(err error) { - t.Fatalf("bad len") - }) - - testutil.WaitForResult(func() (bool, error) { - return len(s2.WANMembers()) == 2, nil - }, func(err error) { - t.Fatalf("bad len") - }) + for i, s := range []*Server{s1, s2} { + testutil.WaitForResult(func() (bool, error) { + return len(s.WANMembers()) == 2, nil + }, func(err error) { + t.Fatalf("bad len for server %d", i) + }) + } dir3, s3 := testServer(t) defer os.RemoveAll(dir3) @@ -265,23 +261,13 @@ func TestServer_JoinWAN_Flood(t *testing.T) { t.Fatalf("err: %v", err) } - testutil.WaitForResult(func() (bool, error) { - return len(s1.WANMembers()) == 3, nil - }, func(err error) { - t.Fatalf("bad len") - }) - - testutil.WaitForResult(func() (bool, error) { - return len(s2.WANMembers()) == 3, nil - }, func(err error) { - t.Fatalf("bad len") - }) - - testutil.WaitForResult(func() (bool, error) { - return len(s3.WANMembers()) == 3, nil - }, func(err error) { - t.Fatalf("bad len") - }) + for i, s := range []*Server{s1, s2, s3} { + testutil.WaitForResult(func() (bool, error) { + return len(s.WANMembers()) == 3, nil + }, func(err error) { + t.Fatalf("bad len for server %d", i) + }) + } } func TestServer_JoinSeparateLanAndWanAddresses(t *testing.T) {