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

[JENKINS-58290] Verifying ContainerExecDecorator scalability #522

Merged
merged 10 commits into from
Jul 6, 2019
Merged
8 changes: 5 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>3.46</version>
<version>3.47</version>
<relativePath />
</parent>

<groupId>org.csanchez.jenkins.plugins</groupId>
Expand Down Expand Up @@ -94,10 +95,10 @@
<version>6.8</version>
</dependency>

<dependency> <!-- OnceRetentionStrategy -->
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>durable-task</artifactId>
<version>1.29</version>
<version>1.30</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down Expand Up @@ -306,6 +307,7 @@
<configuration>
<systemPropertyVariables>
<hudson.slaves.NodeProvisioner.initialDelay>0</hudson.slaves.NodeProvisioner.initialDelay>
<hudson.slaves.NodeProvisioner.recurrencePeriod>1000</hudson.slaves.NodeProvisioner.recurrencePeriod>
<!-- listen in this interface for connections from kubernetes pods -->
<connectorHost>${connectorHost}</connectorHost>
<!-- have pods connect to this address for Jenkins -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@
import com.cloudbees.plugins.credentials.SystemCredentialsProvider;
import com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials;
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
import org.jenkinsci.plugins.durabletask.BourneShellScript;

public class ContainerExecDecoratorPipelineTest extends AbstractKubernetesPipelineTest {

@Rule
public LoggerRule containerExecLogs = new LoggerRule()
.record(Logger.getLogger(ContainerExecDecorator.class.getName()), Level.ALL);
.record(Logger.getLogger(ContainerExecDecorator.class.getName()), Level.ALL)
.record(BourneShellScript.class, Level.ALL);

@Issue({ "JENKINS-47225", "JENKINS-42582" })
@Test
Expand Down Expand Up @@ -77,4 +79,16 @@ public void docker() throws Exception {
assertFalse("credential leaked to log",
containerExecLogs.getMessages().stream().anyMatch(msg -> msg.contains("secret_password")));
}

@Issue("JENKINS-58290")
@Test
public void websocket() throws Exception {
assertNotNull(createJobThenScheduleRun());
containerExecLogs.capture(1000);
r.waitForMessage("have started user process", b);
assertTrue("WebSocket was closed in a timely fashion", containerExecLogs.getMessages().stream().anyMatch(m -> m.startsWith("onClose : ")));
b.getExecutor().interrupt();
r.waitForCompletion(b);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
podTemplate(label: '$NAME', containers: [
containerTemplate(name: 'busybox', image: 'busybox', ttyEnabled: true, command: '/bin/cat'),
]) {
node('$NAME') {
container('busybox') {
sh 'sleep 5; echo have started user process; sleep 999'
}
}
}