aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/api
diff options
context:
space:
mode:
authorKiran Kamineni <kiran.k.kamineni@intel.com>2019-01-18 16:54:25 -0800
committerKiran Kamineni <kiran.k.kamineni@intel.com>2019-01-18 16:54:30 -0800
commit96c1fc6a2be0cf4dc39d93bfc7f8df0cd76a7b14 (patch)
tree6ca4e827f22237a159c651cee285ffb9f3de8649 /src/k8splugin/api
parent4bfbc6d3fb1cb11ac2a409764a1380d1741f2af1 (diff)
Fix sorting with right index value
Fix the less function used in sort.Slice with the right index. I am using the same index which obviously will not work. Issue-ID: MULTICLOUD-439 Change-Id: Ibb78c03d67cf59e3941acc786796d0cc69b4f0aa Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
Diffstat (limited to 'src/k8splugin/api')
-rw-r--r--src/k8splugin/api/defhandler_test.go4
-rw-r--r--src/k8splugin/api/profilehandler_test.go4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/k8splugin/api/defhandler_test.go b/src/k8splugin/api/defhandler_test.go
index 3dbd1aa4..fd17f50e 100644
--- a/src/k8splugin/api/defhandler_test.go
+++ b/src/k8splugin/api/defhandler_test.go
@@ -216,12 +216,12 @@ func TestRBDefListHandler(t *testing.T) {
// Since the order of returned slice is not guaranteed
// Check both and return error if both don't match
sort.Slice(got, func(i, j int) bool {
- return got[i].UUID < got[i].UUID
+ return got[i].UUID < got[j].UUID
})
// Sort both as it is not expected that testCase.expected
// is sorted
sort.Slice(testCase.expected, func(i, j int) bool {
- return testCase.expected[i].UUID < testCase.expected[i].UUID
+ return testCase.expected[i].UUID < testCase.expected[j].UUID
})
if reflect.DeepEqual(testCase.expected, got) == false {
diff --git a/src/k8splugin/api/profilehandler_test.go b/src/k8splugin/api/profilehandler_test.go
index 87725882..49efd659 100644
--- a/src/k8splugin/api/profilehandler_test.go
+++ b/src/k8splugin/api/profilehandler_test.go
@@ -223,12 +223,12 @@ func TestRBProfileListHandler(t *testing.T) {
// Since the order of returned slice is not guaranteed
// Check both and return error if both don't match
sort.Slice(got, func(i, j int) bool {
- return got[i].UUID < got[i].UUID
+ return got[i].UUID < got[j].UUID
})
// Sort both as it is not expected that testCase.expected
// is sorted
sort.Slice(testCase.expected, func(i, j int) bool {
- return testCase.expected[i].UUID < testCase.expected[i].UUID
+ return testCase.expected[i].UUID < testCase.expected[j].UUID
})
if reflect.DeepEqual(testCase.expected, got) == false {