Skip to content

Commit

Permalink
Merge pull request #3158 from oleg-nenashev/tests/SetupWizard_Protoco…
Browse files Browse the repository at this point in the history
…lMonitor

Disable flaky SetupWizardTest#shouldDisableUnencrypterProtocolsByDefault()
  • Loading branch information
oleg-nenashev committed Nov 26, 2017
2 parents b3cd925 + 7db8e7f commit 56f5abd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 3 additions & 2 deletions test/src/test/java/jenkins/AgentProtocolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ public static void assertProtocols(Jenkins jenkins, boolean shouldBeEnabled, @Ch
}
}

public static void assertMonitorNotActive() {
public static void assertMonitorNotActive(JenkinsRule j) {
DeprecatedAgentProtocolMonitor monitor = new DeprecatedAgentProtocolMonitor();
assertFalse("Deprecated Agent Protocol Monitor should not be activated", monitor.isActivated());
assertFalse("Deprecated Agent Protocol Monitor should not be activated. Current protocols: "
+ StringUtils.join(j.jenkins.getAgentProtocols(), ","), monitor.isActivated());
}

public static void assertMonitorTriggered(String ... expectedProtocols) {
Expand Down
11 changes: 9 additions & 2 deletions test/src/test/java/jenkins/install/SetupWizardTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import jenkins.AgentProtocolTest;
import jenkins.slaves.DeprecatedAgentProtocolMonitor;
import org.apache.commons.io.FileUtils;
import static org.hamcrest.Matchers.*;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
Expand Down Expand Up @@ -114,16 +117,20 @@ public void shouldProhibitAccessToPluginListWithoutAuth() throws Exception {
wc.assertFails("setupWizard/createAdminUser", 403);
wc.assertFails("setupWizard/completeInstall", 403);
}


//TODO: The test randomly fails on Jenkins CI
// Oleg Nenashev: I am not able to reproduce it
@Test
@Issue("JENKINS-45841")
@Ignore
public void shouldDisableUnencryptedProtocolsByDefault() throws Exception {
AgentProtocolTest.assertProtocols(j.jenkins, true,
"Encrypted JNLP4-protocols protocol should be enabled", "JNLP4-connect");
AgentProtocolTest.assertProtocols(j.jenkins, false,
"Non-encrypted JNLP protocols should be disabled by default",
"JNLP-connect", "JNLP2-connect", "CLI-connect");
AgentProtocolTest.assertMonitorNotActive();
// The CI test fails here, presumably due to the CLI protocols.
AgentProtocolTest.assertMonitorNotActive(j);
}

private String jsonRequest(JenkinsRule.WebClient wc, String path) throws Exception {
Expand Down

0 comments on commit 56f5abd

Please sign in to comment.