diff --git a/test/src/test/java/hudson/cli/ClientAuthenticationCacheWithUserSeedTest.java b/test/src/test/java/hudson/cli/ClientAuthenticationCacheWithUserSeedTest.java index bcdab7f84458041140c7c90500bfe18e1e7d5a7b..61a1f27b20113cc0dd78c319b298c35e91dd590c 100644 --- a/test/src/test/java/hudson/cli/ClientAuthenticationCacheWithUserSeedTest.java +++ b/test/src/test/java/hudson/cli/ClientAuthenticationCacheWithUserSeedTest.java @@ -35,6 +35,7 @@ import org.acegisecurity.Authentication; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.apache.commons.io.FileUtils; import org.apache.commons.io.output.TeeOutputStream; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; @@ -49,6 +50,7 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.util.Arrays; import java.util.List; +import java.util.Set; import java.util.logging.Level; import static org.hamcrest.CoreMatchers.is; @@ -69,6 +71,18 @@ public class ClientAuthenticationCacheWithUserSeedTest { @Rule public LoggerRule logging = new LoggerRule().record(ClientAuthenticationCache.class, Level.FINER); + @Before + public void enableCLIProtocol2() { + // especially required when the CLI2-connect is disabled by default + Set protocols = r.jenkins.getAgentProtocols(); + protocols.add(CliProtocol.all().stream() + .filter(prot -> prot instanceof CliProtocol2) + .findFirst().orElseThrow(() -> new AssertionError("CLI2-connect must be present")) + .getName()); + + r.jenkins.setAgentProtocols(protocols); + } + @Test @Issue("SECURITY-1247") public void legacyCache_smoothlyMigratedWithUserSeed() throws Exception {