Skip to content

Commit 55022a1

Browse files
authored
Merge pull request kubernetes-client#2540 from rjeberhard/rjeberha/gka-async
Add asynchronous methods to GenericKubernetesApi
2 parents 42f0b06 + d3b486a commit 55022a1

File tree

9 files changed

+1227
-226
lines changed

9 files changed

+1227
-226
lines changed

extended/src/test/java/io/kubernetes/client/extended/kubectl/KubectlAnnotateTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
package io.kubernetes.client.extended.kubectl;
1414

1515
import static com.github.tomakehurst.wiremock.client.WireMock.*;
16+
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
1617
import static org.junit.Assert.assertNotNull;
1718
import static org.junit.Assert.assertThrows;
1819

@@ -32,13 +33,13 @@ public class KubectlAnnotateTest {
3233

3334
private ApiClient apiClient;
3435

35-
@Rule public WireMockRule wireMockRule = new WireMockRule(8384);
36+
@Rule public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
3637

3738
@Before
3839
public void setup() throws IOException {
3940
ModelMapper.addModelMap("", "v1", "Pod", "pods", true, V1Pod.class);
4041
ModelMapper.addModelMap("", "v1", "Node", "nodes", false, V1Node.class);
41-
apiClient = new ClientBuilder().setBasePath("http://localhost:" + 8384).build();
42+
apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockRule.port()).build();
4243
}
4344

4445
@Test

extended/src/test/java/io/kubernetes/client/extended/kubectl/KubectlApplyTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import static com.github.tomakehurst.wiremock.client.WireMock.patch;
1818
import static com.github.tomakehurst.wiremock.client.WireMock.patchRequestedFor;
1919
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
20+
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
2021
import static org.junit.Assert.assertNotNull;
2122

2223
import com.github.tomakehurst.wiremock.junit.WireMockRule;
@@ -59,11 +60,11 @@ public class KubectlApplyTest {
5960

6061
private ApiClient apiClient;
6162

62-
@Rule public WireMockRule wireMockRule = new WireMockRule(8384);
63+
@Rule public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
6364

6465
@Before
6566
public void setup() throws IOException {
66-
apiClient = new ClientBuilder().setBasePath("http://localhost:" + 8384).build();
67+
apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockRule.port()).build();
6768
}
6869

6970
@Test

extended/src/test/java/io/kubernetes/client/extended/kubectl/KubectlCreateTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
package io.kubernetes.client.extended.kubectl;
1414

1515
import static com.github.tomakehurst.wiremock.client.WireMock.*;
16+
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
1617
import static org.junit.Assert.assertNotNull;
1718

1819
import com.github.tomakehurst.wiremock.junit.WireMockRule;
@@ -51,11 +52,11 @@ public class KubectlCreateTest {
5152

5253
private ApiClient apiClient;
5354

54-
@Rule public WireMockRule wireMockRule = new WireMockRule(8384);
55+
@Rule public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
5556

5657
@Before
5758
public void setup() throws IOException {
58-
apiClient = new ClientBuilder().setBasePath("http://localhost:" + 8384).build();
59+
apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockRule.port()).build();
5960
}
6061

6162
@Test

extended/src/test/java/io/kubernetes/client/extended/kubectl/KubectlLabelTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import static com.github.tomakehurst.wiremock.client.WireMock.put;
2121
import static com.github.tomakehurst.wiremock.client.WireMock.putRequestedFor;
2222
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
23+
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
2324
import static org.junit.Assert.assertNotNull;
2425
import static org.junit.Assert.assertThrows;
2526

@@ -39,13 +40,13 @@ public class KubectlLabelTest {
3940

4041
private ApiClient apiClient;
4142

42-
@Rule public WireMockRule wireMockRule = new WireMockRule(8384);
43+
@Rule public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
4344

4445
@Before
4546
public void setup() throws IOException {
4647
ModelMapper.addModelMap("", "v1", "Pod", "pods", true, V1Pod.class);
4748
ModelMapper.addModelMap("", "v1", "Node", "nodes", false, V1Node.class);
48-
apiClient = new ClientBuilder().setBasePath("http://localhost:" + 8384).build();
49+
apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockRule.port()).build();
4950
}
5051

5152
@Test

0 commit comments

Comments
 (0)