From f534d6c8f6873907cebbe742b5614ca94c3063c2 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Mon, 7 Jul 2014 15:11:31 -0700 Subject: [PATCH] etcd: fix machines endpoint test --- etcd/v2_http_endpoint_test.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/etcd/v2_http_endpoint_test.go b/etcd/v2_http_endpoint_test.go index e9f7c75ac..6ed8a2966 100644 --- a/etcd/v2_http_endpoint_test.go +++ b/etcd/v2_http_endpoint_test.go @@ -3,6 +3,8 @@ package etcd import ( "io/ioutil" "net/http" + "reflect" + "sort" "strings" "testing" ) @@ -11,11 +13,10 @@ func TestMachinesEndPoint(t *testing.T) { es, hs := buildCluster(3) waitCluster(t, es) - us := make([]string, len(hs)) + w := make([]string, len(hs)) for i := range hs { - us[i] = hs[i].URL + w[i] = hs[i].URL } - w := strings.Join(us, ",") for i := range hs { r, err := http.Get(hs[i].URL + v2machinePrefix) @@ -29,8 +30,10 @@ func TestMachinesEndPoint(t *testing.T) { t.Errorf("%v", err) break } - if string(b) != w { - t.Errorf("machines = %v, want %v", string(b), w) + g := strings.Split(string(b), ",") + sort.Strings(g) + if !reflect.DeepEqual(w, g) { + t.Errorf("machines = %v, want %v", g, w) } }