Skip to content

Commit 37701b1

Browse files
committed
trying to write TLS based test for agents
1 parent 16bcf91 commit 37701b1

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package jenkins.agents;
2+
3+
import org.junit.Before;
4+
import org.junit.Rule;
5+
import org.junit.Test;
6+
import org.jvnet.hudson.test.InboundAgentRule;
7+
import org.jvnet.hudson.test.RealJenkinsRule;
8+
9+
public class TLSCustomCertificateTest {
10+
11+
@Rule
12+
public final RealJenkinsRule rjr = new RealJenkinsRule().https();
13+
14+
@Rule
15+
public InboundAgentRule iar = new InboundAgentRule();
16+
17+
@Before
18+
public void setUp() throws Throwable {
19+
rjr.startJenkins();
20+
}
21+
22+
@Test
23+
public void test_noCertificateCheck_worksInWebSocketAgent() throws Throwable {
24+
// TODO need to configure `-noCertificateCheck` option
25+
var options = InboundAgentRule.Options
26+
.newBuilder()
27+
.webSocket();
28+
29+
iar.createAgent(rjr, options.build());
30+
// try to run a build to ensure agent is connected.
31+
}
32+
33+
@Test
34+
public void test_cert_worksInWebSocketAgent() throws Throwable {
35+
// TODO need to configure `-cert` option with passing the rootCA as a string variable
36+
var options = InboundAgentRule.Options
37+
.newBuilder()
38+
.webSocket();
39+
40+
iar.createAgent(rjr, options.build());
41+
// try to run a build to ensure agent is connected.
42+
}
43+
}

0 commit comments

Comments
 (0)