Github user arina-ielchiieva commented on a diff in the pull request:
https://github.com/apache/drill/pull/1142#discussion_r171607424
--- Diff:
contrib/storage-opentsdb/src/test/java/org/apache/drill/store/openTSDB/TestOpenTSDBPlugin.java
---
@@ -185,4 +188,26 @@ public void testDescribe() throws Exception {
test("describe `warp.speed.test`");
Assert.assertEquals(1, testSql("show tables"));
}
+
+ /**
+ * Checks that port with specified number is free and returns it.
+ * Otherwise, increases port number and checks until free port is found
+ * or the number of attempts is reached specified numAttempts
+ *
+ * @param portNum initial port number
+ * @param numAttempts max number of attempts to find port with greater
number
+ * @return free port number
+ * @throws BindException if free port was not found and all attempts
were used.
+ */
+ private static int getFreePortNum(int portNum, int numAttempts) throws
IOException {
+ while (numAttempts > 0) {
--- End diff --
1. Please re-write using for loop.
2. Please add more details to the exception, include initial port number,
which ports were occupied. Suggest to check which ports are free etc.
---