Fix test sorting function

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
pull/645/head
Andy Goldstein 2018-07-05 16:08:05 -04:00
parent a70456f5ee
commit 9db5e36b54
No known key found for this signature in database
GPG Key ID: FA22ADBD89CBE9E8
1 changed files with 5 additions and 2 deletions

View File

@ -319,11 +319,14 @@ func TestGetSnapshotsInBackup(t *testing.T) {
// sort to ensure good compare of slices
less := func(snapshots []SnapshotIdentifier) func(i, j int) bool {
return func(i, j int) bool {
return snapshots[i].Repo < snapshots[j].Repo &&
snapshots[i].SnapshotID < snapshots[j].SnapshotID
if snapshots[i].Repo == snapshots[j].Repo {
return snapshots[i].SnapshotID < snapshots[j].SnapshotID
}
return snapshots[i].Repo < snapshots[j].Repo
}
}
sort.Slice(test.expected, less(test.expected))
sort.Slice(res, less(res))