File tree Expand file tree Collapse file tree 5 files changed +21
-20
lines changed
util/src/test/java/io/kubernetes/client Expand file tree Collapse file tree 5 files changed +21
-20
lines changed Original file line number Diff line number Diff line change 1919import static com .github .tomakehurst .wiremock .client .WireMock .stubFor ;
2020import static com .github .tomakehurst .wiremock .client .WireMock .urlPathEqualTo ;
2121import static com .github .tomakehurst .wiremock .client .WireMock .verify ;
22+ import static com .github .tomakehurst .wiremock .core .WireMockConfiguration .options ;
2223
2324import com .github .tomakehurst .wiremock .junit .WireMockRule ;
2425import io .kubernetes .client .Attach .AttachResult ;
@@ -38,12 +39,11 @@ public class AttachTest {
3839
3940 private ApiClient client ;
4041
41- private static final int PORT = 8089 ;
42- @ Rule public WireMockRule wireMockRule = new WireMockRule (PORT );
42+ @ Rule public WireMockRule wireMockRule = new WireMockRule (options ().dynamicPort ());
4343
4444 @ Before
4545 public void setup () throws IOException {
46- client = new ClientBuilder ().setBasePath ("http://localhost:" + PORT ).build ();
46+ client = new ClientBuilder ().setBasePath ("http://localhost:" + wireMockRule . port () ).build ();
4747
4848 namespace = "default" ;
4949 podName = "apod" ;
Original file line number Diff line number Diff line change 1212*/
1313package io .kubernetes .client ;
1414
15- import static com .github .tomakehurst .wiremock .client .WireMock .*;
16- import static org .junit .Assert .*;
15+ import static com .github .tomakehurst .wiremock .client .WireMock .aResponse ;
16+ import static com .github .tomakehurst .wiremock .client .WireMock .get ;
17+ import static com .github .tomakehurst .wiremock .client .WireMock .getRequestedFor ;
18+ import static com .github .tomakehurst .wiremock .client .WireMock .urlPathEqualTo ;
19+ import static com .github .tomakehurst .wiremock .client .WireMock .verify ;
20+ import static com .github .tomakehurst .wiremock .core .WireMockConfiguration .options ;
21+ import static org .junit .Assert .assertEquals ;
1722
1823import com .github .tomakehurst .wiremock .junit .WireMockRule ;
1924import io .kubernetes .client .openapi .ApiClient ;
@@ -33,13 +38,11 @@ public class DiscoveryTest {
3338
3439 private ApiClient apiClient ;
3540
36- private static final int PORT = 8089 ;
37-
38- @ Rule public WireMockRule wireMockRule = new WireMockRule (PORT );
41+ @ Rule public WireMockRule wireMockRule = new WireMockRule (options ().dynamicPort ());
3942
4043 @ Before
4144 public void setup () throws IOException {
42- apiClient = new ClientBuilder ().setBasePath ("http://localhost:" + PORT ).build ();
45+ apiClient = new ClientBuilder ().setBasePath ("http://localhost:" + wireMockRule . port () ).build ();
4346 }
4447
4548 @ Test
Original file line number Diff line number Diff line change 1919import static com .github .tomakehurst .wiremock .client .WireMock .stubFor ;
2020import static com .github .tomakehurst .wiremock .client .WireMock .urlPathEqualTo ;
2121import static com .github .tomakehurst .wiremock .client .WireMock .verify ;
22+ import static com .github .tomakehurst .wiremock .core .WireMockConfiguration .options ;
2223import static org .junit .Assert .assertEquals ;
2324
2425import com .github .tomakehurst .wiremock .junit .WireMockRule ;
@@ -58,12 +59,11 @@ public class ExecTest {
5859
5960 private ApiClient client ;
6061
61- private static final int PORT = 8089 ;
62- @ Rule public WireMockRule wireMockRule = new WireMockRule (PORT );
62+ @ Rule public WireMockRule wireMockRule = new WireMockRule (options ().dynamicPort ());
6363
6464 @ Before
6565 public void setup () throws IOException {
66- client = new ClientBuilder ().setBasePath ("http://localhost:" + PORT ).build ();
66+ client = new ClientBuilder ().setBasePath ("http://localhost:" + wireMockRule . port () ).build ();
6767
6868 namespace = "default" ;
6969 podName = "apod" ;
Original file line number Diff line number Diff line change 1919import static com .github .tomakehurst .wiremock .client .WireMock .stubFor ;
2020import static com .github .tomakehurst .wiremock .client .WireMock .urlPathEqualTo ;
2121import static com .github .tomakehurst .wiremock .client .WireMock .verify ;
22+ import static com .github .tomakehurst .wiremock .core .WireMockConfiguration .options ;
2223import static org .junit .Assert .assertEquals ;
2324
2425import com .github .tomakehurst .wiremock .junit .WireMockRule ;
@@ -46,12 +47,11 @@ public class PodLogsTest {
4647
4748 private ApiClient client ;
4849
49- private static final int PORT = 8089 ;
50- @ Rule public WireMockRule wireMockRule = new WireMockRule (PORT );
50+ @ Rule public WireMockRule wireMockRule = new WireMockRule (options ().dynamicPort ());
5151
5252 @ Before
5353 public void setup () throws IOException {
54- client = new ClientBuilder ().setBasePath ("http://localhost:" + PORT ).build ();
54+ client = new ClientBuilder ().setBasePath ("http://localhost:" + wireMockRule . port () ).build ();
5555
5656 namespace = "default" ;
5757 podName = "apod" ;
Original file line number Diff line number Diff line change 1919import static com .github .tomakehurst .wiremock .client .WireMock .stubFor ;
2020import static com .github .tomakehurst .wiremock .client .WireMock .urlPathEqualTo ;
2121import static com .github .tomakehurst .wiremock .client .WireMock .verify ;
22+ import static com .github .tomakehurst .wiremock .core .WireMockConfiguration .options ;
2223import static io .kubernetes .client .ExecTest .makeStream ;
2324import static org .junit .Assert .assertEquals ;
2425import static org .junit .Assert .assertNotNull ;
4546public class PortForwardTest {
4647 private String namespace ;
4748 private String podName ;
48- private String container ;
4949
5050 private ApiClient client ;
5151
52- private static final int PORT = 8089 ;
53- @ Rule public WireMockRule wireMockRule = new WireMockRule (PORT );
52+ @ Rule public WireMockRule wireMockRule = new WireMockRule (options ().dynamicPort ());
5453
5554 @ Before
5655 public void setup () throws IOException {
57- client = new ClientBuilder ().setBasePath ("http://localhost:" + PORT ).build ();
56+ client = new ClientBuilder ().setBasePath ("http://localhost:" + wireMockRule . port () ).build ();
5857
5958 namespace = "default" ;
6059 podName = "apod" ;
61- container = "acontainer" ;
6260 }
6361
6462 @ Test
You can’t perform that action at this time.
0 commit comments