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-65097] Add information about websocket in nodes.md #271

Merged
merged 1 commit into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<properties>
<revision>2.73</revision>
<changelist>-SNAPSHOT</changelist>
<jenkins.version>2.204.6</jenkins.version>
<jenkins.version>2.222.1</jenkins.version>
<java.level>8</java.level>
<configuration-as-code.version>1.36</configuration-as-code.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import hudson.remoting.Launcher;
import hudson.remoting.VirtualChannel;
import hudson.security.Permission;
import hudson.slaves.JNLPLauncher;
import hudson.util.IOUtils;
import jenkins.model.Jenkins;
import jenkins.model.JenkinsLocationConfiguration;
Expand Down Expand Up @@ -659,6 +660,9 @@ private String getLabelString(Node n) {
if (node instanceof Slave) {
Slave slave = (Slave) node;
out.println(" - Launch method: " + getDescriptorName(slave.getLauncher()));
if (slave.getLauncher() instanceof JNLPLauncher) {
out.println(" - WebSocket: " + ((JNLPLauncher) slave.getLauncher()).isWebSocket());
}
out.println(" - Availability: " + getDescriptorName(slave.getRetentionStrategy()));
}
VirtualChannel channel = node.getChannel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.cloudbees.jenkins.support.SupportTestUtils;
import com.cloudbees.jenkins.support.api.Component;
import hudson.ExtensionList;
import hudson.slaves.DumbSlave;
import hudson.slaves.JNLPLauncher;
import jenkins.model.identity.IdentityRootAction;
import jenkins.slaves.RemotingVersionInfo;
import org.junit.Rule;
Expand All @@ -29,6 +31,7 @@ public class AboutJenkinsTest {
@Test
@Issue("JENKINS-56245")
public void testAboutJenkinsContent() {

String aboutMdToString = SupportTestUtils.invokeComponentToString(Objects.requireNonNull(ExtensionList.lookup(Component.class).get(AboutJenkins.class)));

assertThat(aboutMdToString, containsString(" * Instance ID: `" + j.getInstance().getLegacyInstanceId()));
Expand All @@ -38,4 +41,27 @@ public void testAboutJenkinsContent() {
assertThat(aboutMdToString, containsString(" * Embedded Version: `" + RemotingVersionInfo.getEmbeddedVersion().toString()));
assertThat(aboutMdToString, containsString(" * Minimum Supported Version: `" + RemotingVersionInfo.getMinimumSupportedVersion().toString()));
}

@Test
@Issue("JENKINS-65097")
public void testAboutNodesContent() throws Exception {

DumbSlave tcp1 = j.createSlave("tcp1", "test", null);
tcp1.setLauncher(new JNLPLauncher(false));
((JNLPLauncher)tcp1.getLauncher()).setWebSocket(false);
tcp1.save();

String aboutMdToString = SupportTestUtils.invokeComponentToString(Objects.requireNonNull(ExtensionList.lookup(Component.class).get(AboutJenkins.class)));
assertThat(aboutMdToString, containsString(" * `" + tcp1.getNodeName() + "` (`hudson.slaves.DumbSlave`)"));
assertThat(aboutMdToString, containsString(" - Launch method: `hudson.slaves.JNLPLauncher`"));
assertThat(aboutMdToString, containsString(" - WebSocket: false"));

((JNLPLauncher)tcp1.getLauncher()).setWebSocket(true);
tcp1.save();

aboutMdToString = SupportTestUtils.invokeComponentToString(Objects.requireNonNull(ExtensionList.lookup(Component.class).get(AboutJenkins.class)));
assertThat(aboutMdToString, containsString(" * `" + tcp1.getNodeName() + "` (`hudson.slaves.DumbSlave`)"));
assertThat(aboutMdToString, containsString(" - Launch method: `hudson.slaves.JNLPLauncher`"));
assertThat(aboutMdToString, containsString(" - WebSocket: true"));
}
}