Browse Source

etcdserver: use int64slice directly

Jonathan Boulle 11 years ago
parent
commit
20776f1947
1 changed files with 4 additions and 15 deletions
  1. 4 15
      etcdserver/etcdhttp/peers_test.go

+ 4 - 15
etcdserver/etcdhttp/peers_test.go

@@ -47,10 +47,10 @@ func TestPeers(t *testing.T) {
 		if err != nil {
 			t.Errorf("#%d: err=%v, want nil", i, err)
 		}
-		ids := p.IDs()
-		sortint64(ids)
-		if !reflect.DeepEqual(ids, tt.wids) {
-			t.Errorf("#%d: IDs=%#v, want %#v", i, ids, tt.wids)
+		ids := int64Slice(p.IDs())
+		sort.Sort(ids)
+		if !reflect.DeepEqual([]int64(ids), tt.wids) {
+			t.Errorf("#%d: IDs=%#v, want %#v", i, []int64(ids), tt.wids)
 		}
 		ep := p.Endpoints()
 		if !reflect.DeepEqual(ep, tt.wep) {
@@ -69,17 +69,6 @@ func (p int64Slice) Len() int           { return len(p) }
 func (p int64Slice) Less(i, j int) bool { return p[i] < p[j] }
 func (p int64Slice) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }
 
-func sortint64(list []int64) {
-	sorted := make(int64Slice, len(list))
-	for i, j := range list {
-		sorted[i] = j
-	}
-	sort.Sort(sorted)
-	for i, j := range sorted {
-		list[i] = j
-	}
-}
-
 func TestPeersSetBad(t *testing.T) {
 	tests := []string{
 		// garbage URL