Prechádzať zdrojové kódy

HADOOP-15529. ContainerLaunch#testInvalidEnvVariableSubstitutionType is not supported in Windows. Contributed by Giovanni Matteo Fumarola.

(cherry picked from commit 6e756e8a620e4d6dc3192986679060c52063489b)
Inigo Goiri 7 rokov pred
rodič
commit
6a31dc9927

+ 10 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/TestContainerLaunch.java

@@ -1726,7 +1726,11 @@ public class TestContainerLaunch extends BaseContainerManagerTest {
   public void testInvalidEnvVariableSubstitutionType1() throws IOException {
     Map<String, String> env = new HashMap<String, String>();
     // invalid env
-    env.put("testVar", "version${foo.version}");
+    String invalidEnv = "version${foo.version}";
+    if (Shell.WINDOWS) {
+      invalidEnv = "version%foo%<>^&|=:version%";
+    }
+    env.put("testVar", invalidEnv);
     validateShellExecutorForDifferentEnvs(env);
   }
 
@@ -1737,7 +1741,11 @@ public class TestContainerLaunch extends BaseContainerManagerTest {
   public void testInvalidEnvVariableSubstitutionType2() throws IOException {
     Map<String, String> env = new HashMap<String, String>();
     // invalid env
-    env.put("testPath", "/abc:/${foo.path}:/$bar");
+    String invalidEnv = "/abc:/${foo.path}:/$bar";
+    if (Shell.WINDOWS) {
+      invalidEnv = "/abc:/%foo%<>^&|=:path%:/%bar%";
+    }
+    env.put("testPath", invalidEnv);
     validateShellExecutorForDifferentEnvs(env);
   }