flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject [6/6] flink git commit: [FLINK-3864][yarn] check for prohibited strings in log output
Date Fri, 24 Jun 2016 16:56:10 GMT
[FLINK-3864][yarn] check for prohibited strings in log output

- enables actual checking of output which didn't work until now
- uses regexp to check for prohibited strings

This closes #2125


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

Branch: refs/heads/master
Commit: d92aeb7aa63490278d9a9e36aae595e6cbe39f32
Parents: a5aa4e1
Author: Maximilian Michels <mxm@apache.org>
Authored: Fri Jun 17 14:29:17 2016 +0200
Committer: Maximilian Michels <mxm@apache.org>
Committed: Fri Jun 24 18:53:43 2016 +0200

----------------------------------------------------------------------
 .../flink/yarn/YARNSessionCapacitySchedulerITCase.java |  8 ++++----
 .../test/java/org/apache/flink/yarn/YarnTestBase.java  | 13 +++++++------
 2 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/d92aeb7a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionCapacitySchedulerITCase.java
----------------------------------------------------------------------
diff --git a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionCapacitySchedulerITCase.java
b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionCapacitySchedulerITCase.java
index 826a086..513a9fc 100644
--- a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionCapacitySchedulerITCase.java
+++ b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionCapacitySchedulerITCase.java
@@ -120,8 +120,8 @@ public class YARNSessionCapacitySchedulerITCase extends YarnTestBase {
 				"-ytm", "1024", exampleJarLocation.getAbsolutePath()},
 				/* test succeeded after this string */
 			"Job execution complete",
-				/* prohibited strings: (we want to see (2/2)) */
-			new String[]{"System.out)(1/1) switched to FINISHED "},
+			/* prohibited strings: (we want to see "DataSink (...) (2/2) switched to FINISHED") */
+			new String[]{"DataSink \\(.*\\) \\(1/1\\) switched to FINISHED"},
 			RunTypes.CLI_FRONTEND, 0, true);
 		LOG.info("Finished perJobYarnCluster()");
 	}
@@ -360,8 +360,8 @@ public class YARNSessionCapacitySchedulerITCase extends YarnTestBase {
 				"-ytm", "1024", exampleJarLocation.getAbsolutePath()},
 				/* test succeeded after this string */
 			"Job execution complete",
-				/* prohibited strings: (we want to see (2/2)) */
-			new String[]{"System.out)(1/1) switched to FINISHED "},
+			/* prohibited strings: (we want to see "DataSink (...) (2/2) switched to FINISHED") */
+			new String[]{"DataSink \\(.*\\) \\(1/1\\) switched to FINISHED"},
 			RunTypes.CLI_FRONTEND, 0, true);
 		LOG.info("Finished perJobYarnClusterWithParallelism()");
 	}

http://git-wip-us.apache.org/repos/asf/flink/blob/d92aeb7a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java
----------------------------------------------------------------------
diff --git a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java
index 4de964a..6028d98 100644
--- a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java
+++ b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java
@@ -60,6 +60,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Scanner;
 import java.util.concurrent.ConcurrentMap;
+import java.util.regex.Pattern;
 
 
 /**
@@ -446,12 +447,12 @@ public abstract class YarnTestBase extends TestLogger {
 	 * The test has been passed once the "terminateAfterString" has been seen.
 	 * @param args Command line arguments for the runner
 	 * @param terminateAfterString the runner is searching the stdout and stderr for this string.
as soon as it appears, the test has passed
-	 * @param failOnStrings The runner is searching stdout and stderr for the strings specified
here. If one appears, the test has failed
+	 * @param failOnPatterns The runner is searching stdout and stderr for the pattern (regexp)
specified here. If one appears, the test has failed
 	 * @param type Set the type of the runner
 	 * @param returnCode Expected return code from the runner.
 	 * @param checkLogForTerminateString  If true, the runner checks also the log4j logger for
the terminate string
 	 */
-	protected void runWithArgs(String[] args, String terminateAfterString, String[] failOnStrings,
RunTypes type, int returnCode, boolean checkLogForTerminateString) {
+	protected void runWithArgs(String[] args, String terminateAfterString, String[] failOnPatterns,
RunTypes type, int returnCode, boolean checkLogForTerminateString) {
 		LOG.info("Running with args {}", Arrays.toString(args));
 
 		outContent = new ByteArrayOutputStream();
@@ -473,10 +474,10 @@ public abstract class YarnTestBase extends TestLogger {
 			sleep(1000);
 			String outContentString = outContent.toString();
 			String errContentString = errContent.toString();
-			if(failOnStrings != null) {
-				for (String failOnString : failOnStrings) {
-					if (outContentString.contains(failOnString)
-							|| errContentString.contains(failOnString)) {
+			if(failOnPatterns != null) {
+				for (String failOnString : failOnPatterns) {
+					Pattern pattern = Pattern.compile(failOnString);
+					if (pattern.matcher(outContentString).find() || pattern.matcher(errContentString).find())
{
 						LOG.warn("Failing test. Output contained illegal string '" + failOnString + "'");
 						sendOutput();
 						// stopping runner.


Mime
View raw message