@@ -0,0 +1,2338 @@
+package hudson.slaves;%0A%0Aimport static org.junit.Assert.fail;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Collections;%0Aimport java.util.List;%0Aimport java.util.Set;%0Aimport java.util.concurrent.Callable;%0Aimport java.util.concurrent.ExecutionException;%0Aimport java.util.concurrent.ExecutorService;%0Aimport java.util.concurrent.Executors;%0Aimport java.util.concurrent.Future;%0Aimport java.util.concurrent.atomic.AtomicInteger;%0Aimport java.util.logging.Level;%0Aimport java.util.logging.Logger;%0A%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.jvnet.hudson.test.Issue;%0Aimport org.jvnet.hudson.test.JenkinsRule;%0A%0Apublic class NodeParallelTest %7B%0A%0A    @Rule%0A    public JenkinsRule r = new JenkinsRule();%0A%0A    private static final Logger LOGGER = Logger.getLogger(NodeParallelTest.class.getName());%0A%0A    private final AtomicInteger count = new AtomicInteger();%0A%0A    @Test%0A    @Issue(%22JENKINS-53401%22)%0A    public void createNodesWithParallelThreads() throws InterruptedException, ExecutionException %7B%0A        int n = 50;%0A        List%3CCallable%3CVoid%3E%3E tasks = Collections.nCopies(n, () -%3E %7B%0A            try %7B%0A                int i = count.incrementAndGet();%0A                LOGGER.log(Level.INFO, %22Creating slave %22 + i);%0A                // JenkinsRule sync on Jenkins singleton, so this doesn't work%0A                // r.createSlave();%0A                DumbSlave agent = new DumbSlave(%22agent-%22+i, %22/tmp%22, new JNLPLauncher(true));%0A                r.jenkins.addNode(agent);%0A                agent.setNodeProperties(Collections.singletonList(new EnvironmentVariablesNodeProperty(new EnvironmentVariablesNodeProperty.Entry(%22foo%22, %22%22 + i))));%0A                return null;%0A            %7D catch (Exception e1) %7B%0A                throw new RuntimeException(e1);%0A            %7D%0A        %7D);%0A        ExecutorService executorService = Executors.newFixedThreadPool(n);%0A        List%3CFuture%3CVoid%3E%3E futures = executorService.invokeAll(tasks);%0A        List%3CVoid%3E resultList = new ArrayList%3C%3E(futures.size());%0A        // Check for exceptions%0A        try %7B%0A            for (Future%3CVoid%3E future : futures) %7B%0A                // Throws an exception if an exception was thrown by the task.%0A                resultList.add(future.get());%0A            %7D%0A        %7D catch (RuntimeException e) %7B%0A            e.printStackTrace();%0A            fail(e.getMessage());%0A        %7D%0A    %7D%0A%7D%0A

Add a test failing without the patch