Github user anew commented on a diff in the pull request:
https://github.com/apache/incubator-tephra/pull/62#discussion_r140172872
--- Diff:
tephra-hbase-compat-1.1-base/src/test/java/org/apache/tephra/hbase/txprune/InvalidListPruningDebugTest.java
---
@@ -280,29 +282,36 @@ public void testIdleRegions() throws Exception {
try (PrintWriter out = new PrintWriter(outputStream)) {
// Get the list of regions that have the lowest prune upper bounds
for the latest record time
Long latestRecordTime = compactedRegions.asMap().lastKey();
- SortedSet<InvalidListPruningDebugTool.RegionPruneInfoPretty>
latestExpected =
- ImmutableSortedSet.copyOf(pruneUpperBoundComparator(),
compactedRegions.get(latestRecordTime));
+ List<InvalidListPruningDebugTool.RegionPruneInfoPretty>
latestExpected =
+ Lists.newArrayList(compactedRegions.get(latestRecordTime));
pruningDebug.execute(new String[]{"idle-regions", "-1"}, out);
out.flush();
- Assert.assertEquals(GSON.toJson(latestExpected),
readOutputStream(outputStream));
+ assertEquals(latestExpected, readOutputStream(outputStream));
// Same command with explicit time
outputStream.reset();
pruningDebug.execute(new String[]{"idle-regions", "-1",
String.valueOf(latestRecordTime)}, out);
out.flush();
- Assert.assertEquals(GSON.toJson(latestExpected),
readOutputStream(outputStream));
+ assertEquals(latestExpected, readOutputStream(outputStream));
// Same command with relative time
outputStream.reset();
pruningDebug.execute(new String[]{"idle-regions", "-1", "now-2s"},
out);
out.flush();
- Assert.assertEquals(GSON.toJson(latestExpected),
readOutputStream(outputStream));
+ assertEquals(latestExpected, readOutputStream(outputStream));
// Same command with reduced number of regions
outputStream.reset();
- pruningDebug.execute(new String[]{"idle-regions", "2",
String.valueOf(latestRecordTime)}, out);
+ int limit = 2;
+ pruningDebug.execute(new String[]{"idle-regions",
String.valueOf(limit), String.valueOf(latestRecordTime)}, out);
out.flush();
- Assert.assertEquals(GSON.toJson(subset(latestExpected, 0, 2)),
readOutputStream(outputStream));
+ List<RegionPruneInfo> actualPruneInfos =
GSON.fromJson(readOutputStream(outputStream), PRUNE_INFO_LIST_TYPE);
+ Set<String> actualRegions =
Sets.newHashSet(Iterables.transform(actualPruneInfos, PRUNE_INFO_TO_STRING));
+ // Just comparing sizes, since returned order can be different when
prune upper bounds are the same
--- End diff --
you can make that deterministic, see my comment above
---