flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ches...@apache.org
Subject flink git commit: [FLINK-7228] [history] Use free port in HistoryServerStaticFileServerHandlerTest
Date Fri, 21 Jul 2017 08:59:50 GMT
Repository: flink
Updated Branches:
  refs/heads/master e4e2327e9 -> e5afe563a


[FLINK-7228] [history] Use free port in HistoryServerStaticFileServerHandlerTest

This closes #4366.


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

Branch: refs/heads/master
Commit: e5afe563ad254ae0d5be300475b732f4b17a9770
Parents: e4e2327
Author: zentol <chesnay@apache.org>
Authored: Wed Jul 19 14:45:49 2017 +0200
Committer: zentol <chesnay@apache.org>
Committed: Fri Jul 21 09:33:17 2017 +0200

----------------------------------------------------------------------
 .../HistoryServerStaticFileServerHandlerTest.java     | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/e5afe563/flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/history/HistoryServerStaticFileServerHandlerTest.java
----------------------------------------------------------------------
diff --git a/flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/history/HistoryServerStaticFileServerHandlerTest.java
b/flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/history/HistoryServerStaticFileServerHandlerTest.java
index 733f1d7..cee9248 100644
--- a/flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/history/HistoryServerStaticFileServerHandlerTest.java
+++ b/flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/history/HistoryServerStaticFileServerHandlerTest.java
@@ -49,31 +49,33 @@ public class HistoryServerStaticFileServerHandlerTest {
 			tmp.newFolder("uploadDir"),
 			null,
 			"localhost",
-			8081,
+			0,
 			new Configuration());
+
+		int port = webUI.getServerPort();
 		try {
 			// verify that 404 message is returned when requesting a non-existant file
-			String notFound404 = HistoryServerTest.getFromHTTP("http://localhost:8081/hello");
+			String notFound404 = HistoryServerTest.getFromHTTP("http://localhost:" + port + "/hello");
 			Assert.assertTrue(notFound404.contains("404 Not Found"));
 
 			// verify that a) a file can be loaded using the ClassLoader and b) that the HistoryServer
 			// index_hs.html is injected
-			String index = HistoryServerTest.getFromHTTP("http://localhost:8081/index.html");
+			String index = HistoryServerTest.getFromHTTP("http://localhost:" + port + "/index.html");
 			Assert.assertTrue(index.contains("Completed Jobs"));
 
 			// verify that index.html is appended if the request path ends on '/'
-			String index2 = HistoryServerTest.getFromHTTP("http://localhost:8081/");
+			String index2 = HistoryServerTest.getFromHTTP("http://localhost:" + port + "/");
 			Assert.assertEquals(index, index2);
 
 			// verify that a 404 message is returned when requesting a directory
 			File dir = new File(webDir, "dir.json");
 			dir.mkdirs();
-			String dirNotFound404 = HistoryServerTest.getFromHTTP("http://localhost:8081/dir");
+			String dirNotFound404 = HistoryServerTest.getFromHTTP("http://localhost:" + port + "/dir");
 			Assert.assertTrue(dirNotFound404.contains("404 Not Found"));
 
 			// verify that a 404 message is returned when requesting a file outside the webDir
 			tmp.newFile("secret");
-			String x = HistoryServerTest.getFromHTTP("http://localhost:8081/../secret");
+			String x = HistoryServerTest.getFromHTTP("http://localhost:" + port + "/../secret");
 			Assert.assertTrue(x.contains("404 Not Found"));
 		} finally {
 			webUI.shutdown();


Mime
View raw message