Sort revisions in rollout history as integers

Previously keys were sorted as strings, thus it was possible
to see such order as 1, 10, 2, 3, 4, 5.

Ints64 helper implemented in util/slice module to sort []int64
This commit is contained in:
Dmitry Shulyak
2016-05-18 12:04:29 +03:00
parent e43ec4c445
commit 4a60d3ce60
3 changed files with 28 additions and 16 deletions

View File

@@ -68,3 +68,12 @@ func TestShuffleStrings(t *testing.T) {
}
}
}
func TestSortInts64(t *testing.T) {
src := []int64{10, 1, 2, 3, 4, 5, 6}
expected := []int64{1, 2, 3, 4, 5, 6, 10}
SortInts64(src)
if !reflect.DeepEqual(src, expected) {
t.Errorf("func Ints64 didnt sort correctly, %v !- %v", src, expected)
}
}