This is an automated email from the ASF dual-hosted git repository.

rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new d0f6ba5  Remove default port on api host. (#4504)
d0f6ba5 is described below

commit d0f6ba5a0ad1d7a85afe8ea19c3188efc82de694
Author: rodric rabbah <rod...@gmail.com>
AuthorDate: Wed Jun 5 10:34:47 2019 -0400

    Remove default port on api host. (#4504)
---
 .../org/apache/openwhisk/core/WhiskConfig.scala      | 20 +++++++++++++-------
 tests/src/test/scala/common/WhiskProperties.java     |  7 ++++++-
 .../test/scala/common/rest/WskRestOperations.scala   |  2 +-
 .../docker/test/DockerContainerFactoryTests.scala    |  2 +-
 4 files changed, 21 insertions(+), 10 deletions(-)

diff --git 
a/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala 
b/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala
index 06b797b..4a0fb4f 100644
--- a/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala
+++ b/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala
@@ -19,19 +19,22 @@ package org.apache.openwhisk.core
 
 import java.io.File
 
-import scala.io.Source
+import akka.http.scaladsl.model.Uri.normalize
 import org.apache.openwhisk.common.{Config, Logging}
 
+import scala.io.Source
+import scala.util.Try
+
 /**
  * A set of properties which might be needed to run a whisk microservice 
implemented
  * in scala.
  *
  * @param requiredProperties a Map whose keys define properties that must be 
bound to
- * a value, and whose values are default values. A null value in the Map means 
there is
- * no default value specified, so it must appear in the properties file.
+ *                           a value, and whose values are default values. A 
null value in the Map means there is
+ *                           no default value specified, so it must appear in 
the properties file.
  * @param optionalProperties a set of optional properties (which may not be 
defined).
- * @param propertiesFile a File object, the whisk.properties file, which if 
given contains the property values.
- * @param env an optional environment to initialize from.
+ * @param propertiesFile     a File object, the whisk.properties file, which 
if given contains the property values.
+ * @param env                an optional environment to initialize from.
  */
 class WhiskConfig(requiredProperties: Map[String, String],
                   optionalProperties: Set[String] = Set.empty,
@@ -54,8 +57,11 @@ class WhiskConfig(requiredProperties: Map[String, String],
   val dockerEndpoint = this(WhiskConfig.dockerEndpoint)
   val dockerPort = this(WhiskConfig.dockerPort)
 
-  val wskApiHost = this(WhiskConfig.wskApiProtocol) + "://" + 
this(WhiskConfig.wskApiHostname) + ":" + this(
-    WhiskConfig.wskApiPort)
+  val wskApiHost: String = Try(
+    normalize(
+      
s"${this(WhiskConfig.wskApiProtocol)}://${this(WhiskConfig.wskApiHostname)}:${this(WhiskConfig.wskApiPort)}"))
+    .getOrElse("")
+
   val controllerBlackboxFraction = 
this.getAsDouble(WhiskConfig.controllerBlackboxFraction, 0.10)
   val controllerInstances = this(WhiskConfig.controllerInstances)
 
diff --git a/tests/src/test/scala/common/WhiskProperties.java 
b/tests/src/test/scala/common/WhiskProperties.java
index 26849f5..b53be03 100644
--- a/tests/src/test/scala/common/WhiskProperties.java
+++ b/tests/src/test/scala/common/WhiskProperties.java
@@ -215,7 +215,12 @@ public class WhiskProperties {
     }
 
     public static String getApiHostForAction() {
-        return getApiProto() + "://" + getApiHost() + ":" + getApiPort();
+        String apihost = getApiProto() + "://" + getApiHost() + ":" + 
getApiPort();
+        if (apihost.startsWith("https://";) && apihost.endsWith(":443")) {
+            return apihost.replaceAll(":443", "");
+        } else if (apihost.startsWith("http://";) && apihost.endsWith(":80")) {
+            return apihost.replaceAll(":80", "");
+        } else return apihost;
     }
 
     public static String getApiHostForClient(String subdomain, boolean 
includeProtocol) {
diff --git a/tests/src/test/scala/common/rest/WskRestOperations.scala 
b/tests/src/test/scala/common/rest/WskRestOperations.scala
index 78a4f08..fcf0301 100644
--- a/tests/src/test/scala/common/rest/WskRestOperations.scala
+++ b/tests/src/test/scala/common/rest/WskRestOperations.scala
@@ -764,7 +764,7 @@ class RestActivationOperations(implicit val actorSystem: 
ActorSystem)
       activation.respBody
     } map {
       Right(_)
-    } getOrElse Left(s"Cannot find activation id from '$activation'")
+    } getOrElse Left(s"No activation record for'$activationId'")
 
   }
 
diff --git 
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/docker/test/DockerContainerFactoryTests.scala
 
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/docker/test/DockerContainerFactoryTests.scala
index ff381d1..b0ef1bc 100644
--- 
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/docker/test/DockerContainerFactoryTests.scala
+++ 
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/docker/test/DockerContainerFactoryTests.scala
@@ -85,7 +85,7 @@ class DockerContainerFactoryTests
           "--network",
           "net1",
           "-e",
-          "__OW_API_HOST=://:",
+          "__OW_API_HOST=",
           "--dns",
           "dns1",
           "--dns",

Reply via email to