Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ public void testDeleteRuntimeFailureClosesConnections() throws Exception {
if (conn != null) {
conn.close();
}
// Connection close is asynchronous; poll until both counters drain to 0
// before asserting (asserting synchronously is racy).
hbaseTestUtil.waitFor(30000, 100,
() -> GLOBAL_OPEN_PHOENIX_CONNECTIONS.getMetric().getValue() == 0L);
hbaseTestUtil.waitFor(30000, 100,
() -> GLOBAL_OPEN_INTERNAL_PHOENIX_CONNECTIONS.getMetric().getValue() == 0L);
long connections = GLOBAL_OPEN_PHOENIX_CONNECTIONS.getMetric().getValue();
assertEquals(String.format("Found %d connections still open.", connections), 0, connections);
connections = GLOBAL_OPEN_INTERNAL_PHOENIX_CONNECTIONS.getMetric().getValue();
Expand Down Expand Up @@ -169,7 +175,9 @@ public void testClosedChildConnectionsRemovedFromParentQueue() throws SQLExcepti
} finally {
connection.close();
}
// All 10 child connections should be removed successfully from the queue
// Child-connection reaping is asynchronous; wait until the queue
// drains before asserting.
hbaseTestUtil.waitFor(30000, 100, () -> connection.getChildConnectionsCount() == 0);
assertEquals(0, connection.getChildConnectionsCount());
}
}