Skip to content

Commit

Permalink
[JENKINS-39370] - Update Remoting in Jenkins core to 3.10 (#2886)
Browse files Browse the repository at this point in the history
* Update Remoting in Jenkins core to 3.8

* JENKINS-39370 - Introduce support of Work Directories in remoting (opt-in).
* PR 129 - Allow configuring java.util.logging settings via a property file (-loggingConfig or JUL system property). See the Logging page for more details.
* JENKINS-37567 - Change of the code signing certificate

More info: https://github.com/jenkinsci/remoting/blob/master/CHANGELOG.md#38

* [JENKINS-39370] - Add direct tests for JNLP Launcher start with -workDir

* Pick Remoting 3.9

* Improve error message of LauncherTest#remoteKill()

* Update Remoting to 3.10
  • Loading branch information
oleg-nenashev committed Jul 1, 2017
1 parent b7ec534 commit e7cdd65
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
3 changes: 2 additions & 1 deletion core/src/test/java/hudson/LauncherTest.java
Expand Up @@ -61,7 +61,8 @@ public class LauncherTest {
p.kill();
assertTrue(p.join()!=0);
long end = System.currentTimeMillis();
assertTrue("join finished promptly", (end - start < 15000));
long terminationTime = end - start;
assertTrue("Join did not finish promptly. The completion time (" + terminationTime + "ms) is longer than expected 15s", terminationTime < 15000);
channels.french.call(NOOP); // this only returns after the other side of the channel has finished executing cancellation
Thread.sleep(2000); // more delay to make sure it's gone
assertNull("process should be gone",ProcessTree.get().get(Integer.parseInt(FileUtils.readFileToString(tmp).trim())));
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -168,7 +168,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>remoting</artifactId>
<version>3.7</version>
<version>3.10</version>
</dependency>

<dependency>
Expand Down
32 changes: 31 additions & 1 deletion test/src/test/java/hudson/slaves/JNLPLauncherTest.java
Expand Up @@ -54,15 +54,20 @@
import static org.junit.Assert.fail;

import java.awt.*;
import org.junit.rules.TemporaryFolder;
import org.jvnet.hudson.test.Issue;

/**
* Tests of {@link JNLPLauncher}.
* @author Kohsuke Kawaguchi
*/
public class JNLPLauncherTest {
@Rule public JenkinsRule j = new JenkinsRule();

@Rule public TemporaryFolder tmpDir = new TemporaryFolder();

/**
* Starts a JNLP slave agent and makes sure it successfully connects to Hudson.
* Starts a JNLP agent and makes sure it successfully connects to Jenkins.
*/
@Test
public void testLaunch() throws Exception {
Expand All @@ -71,6 +76,20 @@ public void testLaunch() throws Exception {
Computer c = addTestSlave();
launchJnlpAndVerify(c, buildJnlpArgs(c));
}

/**
* Starts a JNLP agent and makes sure it successfully connects to Jenkins.
*/
@Test
@Issue("JENKINS-39370")
public void testLaunchWithWorkDir() throws Exception {
Assume.assumeFalse("Skipping JNLPLauncherTest.testLaunch because we are running headless", GraphicsEnvironment.isHeadless());
File workDir = tmpDir.newFolder("workDir");

Computer c = addTestSlave();
launchJnlpAndVerify(c, buildJnlpArgs(c).add("-workDir", workDir.getAbsolutePath()));
assertTrue("Remoting work dir should have been created", new File(workDir, "remoting").exists());
}

/**
* Tests the '-headless' option.
Expand All @@ -83,6 +102,17 @@ public void testHeadlessLaunch() throws Exception {
// make sure that onOffline gets called just the right number of times
assertEquals(1, ComputerListener.all().get(ListenerImpl.class).offlined);
}

@Test
@Issue("JENKINS-39370")
public void testHeadlessLaunchWithWorkDir() throws Exception {
Assume.assumeFalse("Skipping JNLPLauncherTest.testLaunch because we are running headless", GraphicsEnvironment.isHeadless());
File workDir = tmpDir.newFolder("workDir");

Computer c = addTestSlave();
launchJnlpAndVerify(c, buildJnlpArgs(c).add("-arg","-headless", "-workDir", workDir.getAbsolutePath()));
assertEquals(1, ComputerListener.all().get(ListenerImpl.class).offlined);
}

@TestExtension("testHeadlessLaunch")
public static class ListenerImpl extends ComputerListener {
Expand Down

0 comments on commit e7cdd65

Please sign in to comment.