From 9db5e36b549e9c55100a58e9eb9d3d75c1c907ed Mon Sep 17 00:00:00 2001 From: Andy Goldstein Date: Thu, 5 Jul 2018 16:08:05 -0400 Subject: [PATCH] Fix test sorting function Signed-off-by: Andy Goldstein --- pkg/restic/common_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/restic/common_test.go b/pkg/restic/common_test.go index f5ea1d166..74afe478d 100644 --- a/pkg/restic/common_test.go +++ b/pkg/restic/common_test.go @@ -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))