mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: use int64slice directly
This commit is contained in:
parent
e18b8c12be
commit
20776f1947
@ -47,10 +47,10 @@ func TestPeers(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("#%d: err=%v, want nil", i, err)
|
t.Errorf("#%d: err=%v, want nil", i, err)
|
||||||
}
|
}
|
||||||
ids := p.IDs()
|
ids := int64Slice(p.IDs())
|
||||||
sortint64(ids)
|
sort.Sort(ids)
|
||||||
if !reflect.DeepEqual(ids, tt.wids) {
|
if !reflect.DeepEqual([]int64(ids), tt.wids) {
|
||||||
t.Errorf("#%d: IDs=%#v, want %#v", i, ids, tt.wids)
|
t.Errorf("#%d: IDs=%#v, want %#v", i, []int64(ids), tt.wids)
|
||||||
}
|
}
|
||||||
ep := p.Endpoints()
|
ep := p.Endpoints()
|
||||||
if !reflect.DeepEqual(ep, tt.wep) {
|
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) 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 (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) {
|
func TestPeersSetBad(t *testing.T) {
|
||||||
tests := []string{
|
tests := []string{
|
||||||
// garbage URL
|
// garbage URL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user