diff --git a/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 b/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 index 2f7d47b1dd0..c27cca676b2 100644 --- a/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 +++ b/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 @@ -1732,7 +1732,11 @@ public class TestContainerLaunch extends BaseContainerManagerTest { public void testInvalidEnvVariableSubstitutionType1() throws IOException { Map env = new HashMap(); // 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); } @@ -1743,7 +1747,11 @@ public class TestContainerLaunch extends BaseContainerManagerTest { public void testInvalidEnvVariableSubstitutionType2() throws IOException { Map env = new HashMap(); // 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); }