ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject [1/2] ambari git commit: AMBARI-14661. Ambari Server Unit Test failure (org.apache.ambari.server.bootstrap.BootStrapResourceTest.bootStrapGet|bootStrapPost) (aonishuk)
Date Fri, 15 Jan 2016 10:35:13 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 5b60f5650 -> 91d5d0302
  refs/heads/trunk 9d39ab2e4 -> 10a07da8f


AMBARI-14661. Ambari Server Unit Test failure (org.apache.ambari.server.bootstrap.BootStrapResourceTest.bootStrapGet|bootStrapPost)
(aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/10a07da8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/10a07da8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/10a07da8

Branch: refs/heads/trunk
Commit: 10a07da8febd0b0c19956aba63096e63c04e8f48
Parents: 9d39ab2
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Fri Jan 15 12:35:02 2016 +0200
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Fri Jan 15 12:35:02 2016 +0200

----------------------------------------------------------------------
 .../ambari/server/bootstrap/BootStrapResourceTest.java | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/10a07da8/ambari-server/src/test/java/org/apache/ambari/server/bootstrap/BootStrapResourceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/bootstrap/BootStrapResourceTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/bootstrap/BootStrapResourceTest.java
index e433879..0e8a562 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/bootstrap/BootStrapResourceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/bootstrap/BootStrapResourceTest.java
@@ -24,7 +24,9 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 
+import java.io.IOException;
 import java.util.ArrayList;
+import java.net.ServerSocket;
 
 import javax.ws.rs.core.MediaType;
 
@@ -80,6 +82,17 @@ public class BootStrapResourceTest extends JerseyTest {
     injector = Guice.createInjector(new MockModule());
   }
 
+  @Override
+  protected int getPort(int defaultPort) {
+    // Find a free port
+    try (ServerSocket socket = new ServerSocket(0)) {
+      return socket.getLocalPort();
+    } catch (IOException e) {
+      // Ignore
+    }
+    return defaultPort;
+  }
+
   protected JSONObject createDummySshInfo() throws JSONException {
     JSONObject json = new JSONObject();
     json.put("sshkey", "awesome");


Mime
View raw message