flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trohrm...@apache.org
Subject [1/2] flink git commit: [FLINK-8562] [tests] Introduce private global configuration to YarnTestBase
Date Thu, 22 Mar 2018 17:33:23 GMT
Repository: flink
Updated Branches:
  refs/heads/release-1.5 69e5d1462 -> 9c105f2c9


[FLINK-8562] [tests] Introduce private global configuration to YarnTestBase


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

Branch: refs/heads/release-1.5
Commit: 9c105f2c982e511bc1274a86d629e7fa26cf7ac8
Parents: 4b66514
Author: Till Rohrmann <trohrmann@apache.org>
Authored: Thu Mar 22 13:16:10 2018 +0100
Committer: Till Rohrmann <trohrmann@apache.org>
Committed: Thu Mar 22 18:33:01 2018 +0100

----------------------------------------------------------------------
 .../yarn/YARNSessionFIFOSecuredITCase.java      | 18 ++++++++++------
 .../flink/yarn/YarnConfigurationITCase.java     |  2 +-
 .../org/apache/flink/yarn/YarnTestBase.java     | 22 ++++++++++++--------
 3 files changed, 26 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/9c105f2c/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionFIFOSecuredITCase.java
----------------------------------------------------------------------
diff --git a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionFIFOSecuredITCase.java
b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionFIFOSecuredITCase.java
index 18e1c3a..46a37a0 100644
--- a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionFIFOSecuredITCase.java
+++ b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionFIFOSecuredITCase.java
@@ -29,6 +29,7 @@ import org.apache.flink.test.util.TestingSecurityContext;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fifo.FifoScheduler;
+import org.hamcrest.Matchers;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
@@ -102,12 +103,17 @@ public class YARNSessionFIFOSecuredITCase extends YARNSessionFIFOITCase
{
 	@Override
 	public void testDetachedMode() throws InterruptedException, IOException {
 		super.testDetachedMode();
-		if (!verifyStringsInNamedLogFiles(
-				new String[]{"Login successful for user", "using keytab file"}, "jobmanager.log") ||
-				!verifyStringsInNamedLogFiles(
-						new String[]{"Login successful for user", "using keytab file"}, "taskmanager.log"))
{
-			Assert.fail("Can not find expected strings in log files.");
-		}
+		final String[] mustHave = {"Login successful for user", "using keytab file"};
+		final boolean jobManagerRunsWithKerberos = verifyStringsInNamedLogFiles(
+			mustHave,
+			"jobmanager.log");
+		final boolean taskManagerRunsWithKerberos = verifyStringsInNamedLogFiles(
+			mustHave, "taskmanager.log");
+
+		Assert.assertThat(
+			"The JobManager and the TaskManager should both run with Kerberos.",
+			jobManagerRunsWithKerberos && taskManagerRunsWithKerberos,
+			Matchers.is(true));
 	}
 
 	/* For secure cluster testing, it is enough to run only one test and override below test
methods

http://git-wip-us.apache.org/repos/asf/flink/blob/9c105f2c/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnConfigurationITCase.java
----------------------------------------------------------------------
diff --git a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnConfigurationITCase.java
b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnConfigurationITCase.java
index 635fdf3..2a1b099 100644
--- a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnConfigurationITCase.java
+++ b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnConfigurationITCase.java
@@ -78,7 +78,7 @@ public class YarnConfigurationITCase extends YarnTestBase {
 	@Test(timeout = 60000)
 	public void testFlinkContainerMemory() throws Exception {
 		final YarnClient yarnClient = getYarnClient();
-		final Configuration configuration = new Configuration(flinkConfiguration.clone());
+		final Configuration configuration = new Configuration(flinkConfiguration);
 
 		final int masterMemory = 64;
 		final int taskManagerMemory = 128;

http://git-wip-us.apache.org/repos/asf/flink/blob/9c105f2c/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 803f89c..73abc87 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
@@ -149,7 +149,9 @@ public abstract class YarnTestBase extends TestLogger {
 
 	private YarnClient yarnClient = null;
 
-	protected static org.apache.flink.configuration.Configuration flinkConfiguration;
+	private static org.apache.flink.configuration.Configuration globalConfiguration;
+
+	protected org.apache.flink.configuration.Configuration flinkConfiguration;
 
 	protected boolean flip6;
 
@@ -217,6 +219,7 @@ public abstract class YarnTestBase extends TestLogger {
 			}
 		}
 
+		flinkConfiguration = new org.apache.flink.configuration.Configuration(globalConfiguration);
 		flip6 = CoreOptions.FLIP6_MODE.equalsIgnoreCase(flinkConfiguration.getString(CoreOptions.MODE));
 	}
 
@@ -512,23 +515,24 @@ public abstract class YarnTestBase extends TestLogger {
 
 			File flinkConfDirPath = findFile(flinkDistRootDir, new ContainsName(new String[]{"flink-conf.yaml"}));
 			Assert.assertNotNull(flinkConfDirPath);
-			flinkConfiguration =
-					GlobalConfiguration.loadConfiguration();
+
+			final String confDirPath = flinkConfDirPath.getParentFile().getAbsolutePath();
+			globalConfiguration = GlobalConfiguration.loadConfiguration(confDirPath);
 
 			if (!StringUtils.isBlank(principal) && !StringUtils.isBlank(keytab)) {
 
 				//copy conf dir to test temporary workspace location
 				tempConfPathForSecureRun = tmp.newFolder("conf");
 
-				String confDirPath = flinkConfDirPath.getParentFile().getAbsolutePath();
 				FileUtils.copyDirectory(new File(confDirPath), tempConfPathForSecureRun);
 
-				flinkConfiguration.setString(SecurityOptions.KERBEROS_LOGIN_KEYTAB.key(), keytab);
-				flinkConfiguration.setString(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL.key(), principal);
-				flinkConfiguration.setString(CoreOptions.MODE.key(), OLD_MODE);
+				globalConfiguration.setString(SecurityOptions.KERBEROS_LOGIN_KEYTAB.key(), keytab);
+				globalConfiguration.setString(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL.key(), principal);
+				globalConfiguration.setString(CoreOptions.MODE.key(), OLD_MODE);
 
-				BootstrapTools.writeConfiguration(flinkConfiguration,
-						new File(tempConfPathForSecureRun, "flink-conf.yaml"));
+				BootstrapTools.writeConfiguration(
+					globalConfiguration,
+					new File(tempConfPathForSecureRun, "flink-conf.yaml"));
 
 				String configDir = tempConfPathForSecureRun.getAbsolutePath();
 


Mime
View raw message