knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject knox git commit: KNOX-1600 - Fix false 403/404 GatewayBasicFuncTest failures
Date Tue, 13 Nov 2018 16:56:58 GMT
Repository: knox
Updated Branches:
  refs/heads/master c5061b843 -> fbd39232a


KNOX-1600 - Fix false 403/404 GatewayBasicFuncTest failures

Signed-off-by: Kevin Risden <krisden@apache.org>


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

Branch: refs/heads/master
Commit: fbd39232ad3a1fe3ec58fafbc37d97293a35a98b
Parents: c5061b8
Author: Kevin Risden <krisden@apache.org>
Authored: Mon Nov 12 17:00:03 2018 -0500
Committer: Kevin Risden <krisden@apache.org>
Committed: Tue Nov 13 11:56:45 2018 -0500

----------------------------------------------------------------------
 .../apache/knox/gateway/GatewayBasicFuncTest.java   | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/fbd39232/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java
b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java
index 997cbee..f91dabb 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java
@@ -62,6 +62,7 @@ import org.hamcrest.Matchers;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Assert;
+import org.junit.Assume;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -3653,27 +3654,30 @@ public class GatewayBasicFuncTest {
     LOG_ENTER();
 
     setupResources();
+
+    InetSocketAddress gatewayAddress = driver.gateway.getAddresses()[0];
+    String gatewayPort = Integer.toString(gatewayAddress.getPort());
+
     //    Now let's make sure we can run this same command from the CLI.
     PrintStream out = System.out;
-    InetSocketAddress gatewayAddress = driver.gateway.getAddresses()[0];
     final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
     System.setOut(new PrintStream(outContent, false, StandardCharsets.UTF_8.name()));
 
     String[] args = {"service-test", "--master", "knox", "--cluster", driver.clusterName,
"--hostname", gatewayAddress.getHostName(),
-        "--port", Integer.toString(gatewayAddress.getPort()), "--u", "kminder","--p", "kminder-password"
};
+        "--port", gatewayPort, "--u", "kminder","--p", "kminder-password" };
     KnoxCLI cli = new KnoxCLI();
     cli.run(args);
 
+    Assume.assumeTrue("Gateway port should not contain status code",
+        !gatewayPort.contains("404") && !gatewayPort.contains("403"));
     assertThat(outContent.toString(StandardCharsets.UTF_8.name()), not(containsString("\"httpCode\":
401")));
-    assertThat( outContent.toString(StandardCharsets.UTF_8.name()), not(containsString("404")));
+    assertThat(outContent.toString(StandardCharsets.UTF_8.name()), not(containsString("404")));
     assertThat(outContent.toString(StandardCharsets.UTF_8.name()), not(containsString("403")));
     outContent.reset();
 
     setupResources();
-
-
     String[] args2 = {"service-test", "--master", "knox", "--cluster", driver.clusterName,
"--hostname", gatewayAddress.getHostName(),
-        "--port", Integer.toString(gatewayAddress.getPort()) };
+        "--port", gatewayPort};
 
     cli = new KnoxCLI();
     cli.run(args2);


Mime
View raw message