The default when sort is off is undefined, but this test at least tries
to verify that results are sorted when it's set or defaults to true.
Notice that sort order is not key, but rather <2i term that matched>/key
Previously it died in all sorts of ways if the packages were merged or
split into weird bits by the network or network library. Now the results
are concatenated and the whole thing parsed in the end.
The code could receive two different error messages depending on where
the 2i timeout occurred (webmachine process vs in the index FSM). Some
extra error handling code in the streaming requests was added since it
was useful when figuring out this bug.
Using the new function to detect when tombstones are really, really gone
so the test is more reliable.
Also, a bit of refactoring of the delete verification and wait_until
functions to make it cleaner.
I was having test failures due to the delete operation timing out
silently. This was due to dependencies not update by rebar in the end.
But in any case, this new function is more robust in detecting when
tombstones are really reaped instead of a sleep call.
Also, matching delete operation so it's noisy when it fails.