You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/05/24 16:32:54 UTC

[GitHub] [flink] tillrohrmann commented on a change in pull request #7895: [FLINK-11126][YARN][security] Filter out AMRMToken in TaskManager‘s credentials

tillrohrmann commented on a change in pull request #7895: [FLINK-11126][YARN][security] Filter out AMRMToken in TaskManager‘s credentials
URL: https://github.com/apache/flink/pull/7895#discussion_r287433179
 
 

 ##########
 File path: flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java
 ##########
 @@ -493,6 +497,59 @@ public boolean accept(File dir, String name) {
 		}
 	}
 
+	public static boolean verifyTokenKindInContainerCredentials(final String[] tokens, final String containerId) {
+		List<String> tokenList = Arrays.asList(tokens);
+		File cwd = new File("target/" + YARN_CONFIGURATION.get(TEST_CLUSTER_NAME_KEY));
+		if (!cwd.exists() || !cwd.isDirectory()) {
+			return false;
+		}
+
+		File containerTokens = findFile(cwd.getAbsolutePath(), new FilenameFilter() {
+			@Override
+			public boolean accept(File dir, String name) {
+				return name.equals(containerId + ".tokens");
+			}
+		});
+
+		if (containerTokens != null) {
+			LOG.info("Verifying tokens in {}", containerTokens.getAbsolutePath());
+
+			Credentials tmCredentials = null;
+			try {
+				tmCredentials = Credentials.readTokenStorageFile(containerTokens, new Configuration());
+			} catch (IOException e) {
+				LOG.warn("Unable to read credential file: " + e.getMessage() + " file: " + containerTokens.getAbsolutePath());
 
 Review comment:
   SHouldn't we simply let the exception bubble up and let the test fail?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services