brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [2/7] incubator-brooklyn git commit: Fix NetworkingUtilsTest.testIsPortAvailableReportsTrueWhenPortIsFree
Date Tue, 17 Nov 2015 18:28:46 GMT
Fix NetworkingUtilsTest.testIsPortAvailableReportsTrueWhenPortIsFree

Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/d192ad04
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/d192ad04
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/d192ad04

Branch: refs/heads/master
Commit: d192ad04f7903b417d77eb99015eaa9c37a2a1b2
Parents: 3fe1d9d
Author: Aled Sage <aled.sage@gmail.com>
Authored: Thu Nov 5 22:36:17 2015 +0000
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Tue Nov 17 17:49:26 2015 +0000

----------------------------------------------------------------------
 .../org/apache/brooklyn/util/net/NetworkingUtilsTest.java   | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d192ad04/utils/common/src/test/java/org/apache/brooklyn/util/net/NetworkingUtilsTest.java
----------------------------------------------------------------------
diff --git a/utils/common/src/test/java/org/apache/brooklyn/util/net/NetworkingUtilsTest.java
b/utils/common/src/test/java/org/apache/brooklyn/util/net/NetworkingUtilsTest.java
index 788b574..811c712 100644
--- a/utils/common/src/test/java/org/apache/brooklyn/util/net/NetworkingUtilsTest.java
+++ b/utils/common/src/test/java/org/apache/brooklyn/util/net/NetworkingUtilsTest.java
@@ -100,14 +100,15 @@ public class NetworkingUtilsTest {
     
     @Test
     public void testIsPortAvailableReportsTrueWhenPortIsFree() throws Exception {
+        final int MIN_FREE = 5;
         int port = 58769;
         int numFree = 0;
-        for (int i = 0; i < 10; i++) {
-            if (Networking.isPortAvailable(port))
+        for (int i = 0; i < 50 && numFree < MIN_FREE; i++) {
+            if (Networking.isPortAvailable(port+i))
                 numFree++;
         }
-        if (numFree<=5)
-            fail("This test requires that at least some ports near 58769+ not be in use.");
+        if (numFree < MIN_FREE)
+            fail("This test requires that at least some ports near "+port+"+ not be in use.");
     }
 
     @Test


Mime
View raw message