Skip to content

Commit 2ac8d07

Browse files
committed
Remove test calls to isKubernetesCI()
No benefit to calling a method that always returns false. The tests now require a docker environment, so they cannot be run on a Kubernetes agent.
1 parent 6969ba6 commit 2ac8d07

File tree

4 files changed

+0
-36
lines changed

4 files changed

+0
-36
lines changed

src/test/java/org/jenkinsci/plugins/gitclient/verifier/AcceptFirstConnectionVerifierTest.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import static org.hamcrest.Matchers.hasItem;
66
import static org.hamcrest.Matchers.is;
77
import static org.hamcrest.io.FileMatchers.anExistingFile;
8-
import static org.jenkinsci.plugins.gitclient.verifier.KnownHostsTestUtil.isKubernetesCI;
98
import static org.mockito.Mockito.spy;
109
import static org.mockito.Mockito.when;
1110

@@ -54,9 +53,6 @@ public void testVerifyHostKeyOption() throws IOException {
5453

5554
@Test
5655
public void testVerifyServerHostKeyWhenFirstConnection() throws Exception {
57-
if (isKubernetesCI()) {
58-
return; // Test fails with connection timeout on ci.jenkins.io kubernetes agents
59-
}
6056
File file = new File(testFolder.getRoot() + "path/to/file");
6157
AcceptFirstConnectionVerifier acceptFirstConnectionVerifier = spy(new AcceptFirstConnectionVerifier());
6258
when(acceptFirstConnectionVerifier.getKnownHostsFile()).thenReturn(file);
@@ -81,9 +77,6 @@ public void testVerifyServerHostKeyWhenFirstConnection() throws Exception {
8177

8278
@Test
8379
public void testVerifyServerHostKeyWhenSecondConnectionWithEqualKeys() throws Exception {
84-
if (isKubernetesCI()) {
85-
return; // Test fails with connection timeout on ci.jenkins.io kubernetes agents
86-
}
8780
String hostKeyEntry =
8881
"|1|FJGXVAi7jMQIsl1J6uE6KnCiteM=|xlH92KQ91GuBgRxvRbU/sBo60Bo= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=";
8982

@@ -112,9 +105,6 @@ public void testVerifyServerHostKeyWhenSecondConnectionWithEqualKeys() throws Ex
112105

113106
@Test
114107
public void testVerifyServerHostKeyWhenHostnameWithoutPort() throws Exception {
115-
if (isKubernetesCI()) {
116-
return; // Test fails with connection timeout on ci.jenkins.io kubernetes agents
117-
}
118108
String hostKeyEntry =
119109
"github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=";
120110
File mockedKnownHosts = knownHostsTestUtil.createFakeKnownHosts(hostKeyEntry);
@@ -138,9 +128,6 @@ public void testVerifyServerHostKeyWhenHostnameWithoutPort() throws Exception {
138128

139129
@Test
140130
public void testVerifyServerHostKeyWhenSecondConnectionWhenNotDefaultAlgorithm() throws Exception {
141-
if (isKubernetesCI()) {
142-
return; // Test fails with connection timeout on ci.jenkins.io kubernetes agents
143-
}
144131
String fileContent =
145132
"""
146133
github.com,140.82.121.4\
@@ -201,9 +188,6 @@ public void testVerifyServerHostKeyWhenSecondConnectionWithNonEqualKeys() throws
201188

202189
@Test
203190
public void testVerifyServerHostKeyWhenConnectionWithAnotherHost() throws Exception {
204-
if (isKubernetesCI()) {
205-
return; // Test fails with connection timeout on ci.jenkins.io kubernetes agents
206-
}
207191
String bitbucketFileContent =
208192
"""
209193
|1|HnmPCP38pBhCY0NUtBXSraOg9pM=|L6YZ9asEeb2xplTDEThGOxRq7ZY=\
@@ -236,9 +220,6 @@ public void testVerifyServerHostKeyWhenConnectionWithAnotherHost() throws Except
236220

237221
@Test
238222
public void testVerifyServerHostKeyWhenHostnamePortProvided() throws Exception {
239-
if (isKubernetesCI()) {
240-
return; // Test fails with connection timeout on ci.jenkins.io kubernetes agents
241-
}
242223
String fileContent =
243224
"""
244225
|1|6uMj3M7sLgZpn54vQbGqgPNTCVM=|OkV9Lu9REJZR5QCVrITAIY34I1M=\

src/test/java/org/jenkinsci/plugins/gitclient/verifier/KnownHostsFileVerifierTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ public void connectWhenHostKeyNotInKnownHostsFileForOtherHostNameThenShouldFail(
6565

6666
@Test
6767
public void connectWhenHostKeyProvidedThenShouldNotFail() throws IOException {
68-
if (isKubernetesCI()) {
69-
return; // Test fails with connection timeout on ci.jenkins.io kubernetes agents
70-
}
7168
KnownHostsFileVerifier knownHostsFileVerifier = spy(new KnownHostsFileVerifier());
7269
when(knownHostsFileVerifier.getKnownHostsFile()).thenReturn(fakeKnownHosts);
7370

@@ -88,9 +85,6 @@ public void connectWhenHostKeyProvidedThenShouldNotFail() throws IOException {
8885

8986
@Test
9087
public void connectWhenHostKeyInKnownHostsFileWithNotDefaultAlgorithmThenShouldNotFail() throws IOException {
91-
if (isKubernetesCI()) {
92-
return; // Test fails with connection timeout on ci.jenkins.io kubernetes agents
93-
}
9488
fakeKnownHosts = knownHostsTestUtil.createFakeKnownHosts(
9589
"fake2.ssh",
9690
"known_hosts_fake2",

src/test/java/org/jenkinsci/plugins/gitclient/verifier/ManuallyProvidedKeyVerifierTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ public void connectWhenHostKeyProvidedForOtherHostNameThenShouldFail() throws Ex
5757

5858
@Test
5959
public void connectWhenHostKeyProvidedThenShouldNotFail() throws Exception {
60-
if (isKubernetesCI()) {
61-
return; // Test fails with connection timeout on ci.jenkins.io kubernetes agents
62-
}
6360
ManuallyProvidedKeyVerifier verifier = new ManuallyProvidedKeyVerifier(hostKey);
6461
ManuallyProvidedKeyVerifier.ManuallyProvidedKeyJGitHostKeyVerifier jGitHostKeyVerifier =
6562
(ManuallyProvidedKeyVerifier.ManuallyProvidedKeyJGitHostKeyVerifier)
@@ -97,9 +94,6 @@ public void connectWhenWrongHostKeyProvidedThenShouldFail() throws Exception {
9794

9895
@Test
9996
public void connectWhenHostKeyProvidedWithPortThenShouldNotFail() throws Exception {
100-
if (isKubernetesCI()) {
101-
return; // Test fails with connection timeout on ci.jenkins.io kubernetes agents
102-
}
10397
String key =
10498
"github.com:22 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=";
10599
HostKeyVerifierFactory verifier = new ManuallyProvidedKeyVerifier(key);

src/test/java/org/jenkinsci/plugins/gitclient/verifier/NoHostKeyVerifierTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import static org.hamcrest.MatcherAssert.assertThat;
44
import static org.hamcrest.Matchers.is;
5-
import static org.jenkinsci.plugins.gitclient.verifier.KnownHostsTestUtil.isKubernetesCI;
65

76
import hudson.model.StreamBuildListener;
87
import hudson.model.TaskListener;
@@ -24,10 +23,6 @@ public void assignVerifier() {
2423

2524
@Test
2625
public void verifyServerHostKey() throws IOException {
27-
if (isKubernetesCI()) {
28-
return; // Test fails with connection timeout on ci.jenkins.io kubernetes agents
29-
}
30-
3126
NoHostKeyVerifier acceptFirstConnectionVerifier = new NoHostKeyVerifier();
3227

3328
KnownHostsTestUtil.connectToHost(

0 commit comments

Comments
 (0)