Fix test relying on specific order of getindices.

As getindices returned list is not guaranteed to be in any specific
order we should sort the results before comparing expected and actual
test results.