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 Tue, 25 Jul 2017 10:09:29 GMT
Repository: flink
Updated Branches:
  refs/heads/release-1.3 0c9bee696 -> e3e71052e


[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/e3e71052
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/e3e71052
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/e3e71052

Branch: refs/heads/release-1.3
Commit: e3e71052efc33e384c916b9960077b21cd2b9ee3
Parents: 0c9bee6
Author: zentol <chesnay@apache.org>
Authored: Wed Jul 19 14:45:49 2017 +0200
Committer: zentol <chesnay@apache.org>
Committed: Tue Jul 25 12:08:31 2017 +0200

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


http://git-wip-us.apache.org/repos/asf/flink/blob/e3e71052/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 3eff02a..0e330e4 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
@@ -44,31 +44,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