You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2017/02/16 16:14:13 UTC

flink git commit: [FLINK-5811] [tests] Harden YarnClusterDescriptorTest

Repository: flink
Updated Branches:
  refs/heads/master 413609d13 -> 494edb041


[FLINK-5811] [tests] Harden YarnClusterDescriptorTest

Add fail call after method which is supposed to fail. Remove stack trace printing
to stdout.

This closes #3326.


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

Branch: refs/heads/master
Commit: 494edb041b5e8474c84eed563e9dfa4406240bb5
Parents: 413609d
Author: Till Rohrmann <tr...@apache.org>
Authored: Wed Feb 15 17:51:02 2017 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Thu Feb 16 17:13:44 2017 +0100

----------------------------------------------------------------------
 .../flink/yarn/YarnClusterDescriptorTest.java   | 21 ++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/494edb04/flink-yarn/src/test/java/org/apache/flink/yarn/YarnClusterDescriptorTest.java
----------------------------------------------------------------------
diff --git a/flink-yarn/src/test/java/org/apache/flink/yarn/YarnClusterDescriptorTest.java b/flink-yarn/src/test/java/org/apache/flink/yarn/YarnClusterDescriptorTest.java
index 467917e..70ccae8 100644
--- a/flink-yarn/src/test/java/org/apache/flink/yarn/YarnClusterDescriptorTest.java
+++ b/flink-yarn/src/test/java/org/apache/flink/yarn/YarnClusterDescriptorTest.java
@@ -23,7 +23,6 @@ import org.apache.flink.configuration.IllegalConfigurationException;
 import org.apache.flink.yarn.cli.FlinkYarnSessionCli;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.yarn.api.ApplicationConstants;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -32,6 +31,7 @@ import org.junit.rules.TemporaryFolder;
 import java.io.File;
 import java.io.IOException;
 
+import static org.junit.Assert.fail;
 import static org.junit.Assert.assertEquals;
 
 public class YarnClusterDescriptorTest {
@@ -64,8 +64,13 @@ public class YarnClusterDescriptorTest {
 
 		try {
 			clusterDescriptor.deploy();
-		} catch (Exception e) {
-			Assert.assertTrue(e.getCause() instanceof IllegalConfigurationException);
+
+			fail("The deploy call should have failed.");
+		} catch (RuntimeException e) {
+			// we expect the cause to be an IllegalConfigurationException
+			if (!(e.getCause() instanceof IllegalConfigurationException)) {
+				throw e;
+			}
 		}
 	}
 
@@ -88,9 +93,13 @@ public class YarnClusterDescriptorTest {
 
 		try {
 			clusterDescriptor.deploy();
-		} catch (Exception e) {
-			e.printStackTrace();
-			Assert.assertTrue(e.getCause() instanceof IllegalConfigurationException);
+
+			fail("The deploy call should have failed.");
+		} catch (RuntimeException e) {
+			// we expect the cause to be an IllegalConfigurationException
+			if (!(e.getCause() instanceof IllegalConfigurationException)) {
+				throw e;
+			}
 		}
 	}