Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for JENKINS-39443 #100

Merged
merged 1 commit into from Jun 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,5 +1,7 @@
package hudson.plugins.swarm;

import static org.junit.Assert.assertTrue;

import hudson.Functions;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
Expand All @@ -9,11 +11,13 @@
import hudson.tasks.BatchFile;
import hudson.tasks.CommandInterpreter;
import hudson.tasks.Shell;
import org.junit.After;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.jvnet.hudson.test.BuildWatcher;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;

public class SwarmClientIntegrationTest {
Expand Down Expand Up @@ -42,10 +46,20 @@ public void buildShellScript() throws Exception {

FreeStyleBuild build = j.buildAndAssertSuccess(project);
j.assertLogContains("ON_SWARM_CLIENT=true", build);
tearDown();
}

private void tearDown() {
/** Ensures that a node can be created with a colon in the description. */
@Test
@Issue("JENKINS-39443")
public void sanitizeDescription() throws Exception {
Node node =
TestUtils.createSwarmClient(
j, processDestroyer, temporaryFolder, "-description", "swarm_ip:127.0.0.1");
assertTrue(node.getNodeDescription().endsWith("swarm_ip:127.0.0.1"));
}

@After
public void tearDown() {
try {
processDestroyer.clean();
} catch (InterruptedException e) {
Expand Down