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 19
19
import static com .github .tomakehurst .wiremock .client .WireMock .stubFor ;
20
20
import static com .github .tomakehurst .wiremock .client .WireMock .urlPathEqualTo ;
21
21
import static com .github .tomakehurst .wiremock .client .WireMock .verify ;
22
+ import static com .github .tomakehurst .wiremock .core .WireMockConfiguration .options ;
22
23
23
24
import com .github .tomakehurst .wiremock .junit .WireMockRule ;
24
25
import io .kubernetes .client .Attach .AttachResult ;
@@ -38,12 +39,11 @@ public class AttachTest {
38
39
39
40
private ApiClient client ;
40
41
41
- private static final int PORT = 8089 ;
42
- @ Rule public WireMockRule wireMockRule = new WireMockRule (PORT );
42
+ @ Rule public WireMockRule wireMockRule = new WireMockRule (options ().dynamicPort ());
43
43
44
44
@ Before
45
45
public void setup () throws IOException {
46
- client = new ClientBuilder ().setBasePath ("http://localhost:" + PORT ).build ();
46
+ client = new ClientBuilder ().setBasePath ("http://localhost:" + wireMockRule . port () ).build ();
47
47
48
48
namespace = "default" ;
49
49
podName = "apod" ;
Original file line number Diff line number Diff line change 12
12
*/
13
13
package io .kubernetes .client ;
14
14
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 ;
17
22
18
23
import com .github .tomakehurst .wiremock .junit .WireMockRule ;
19
24
import io .kubernetes .client .openapi .ApiClient ;
@@ -33,13 +38,11 @@ public class DiscoveryTest {
33
38
34
39
private ApiClient apiClient ;
35
40
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 ());
39
42
40
43
@ Before
41
44
public void setup () throws IOException {
42
- apiClient = new ClientBuilder ().setBasePath ("http://localhost:" + PORT ).build ();
45
+ apiClient = new ClientBuilder ().setBasePath ("http://localhost:" + wireMockRule . port () ).build ();
43
46
}
44
47
45
48
@ Test
Original file line number Diff line number Diff line change 19
19
import static com .github .tomakehurst .wiremock .client .WireMock .stubFor ;
20
20
import static com .github .tomakehurst .wiremock .client .WireMock .urlPathEqualTo ;
21
21
import static com .github .tomakehurst .wiremock .client .WireMock .verify ;
22
+ import static com .github .tomakehurst .wiremock .core .WireMockConfiguration .options ;
22
23
import static org .junit .Assert .assertEquals ;
23
24
24
25
import com .github .tomakehurst .wiremock .junit .WireMockRule ;
@@ -58,12 +59,11 @@ public class ExecTest {
58
59
59
60
private ApiClient client ;
60
61
61
- private static final int PORT = 8089 ;
62
- @ Rule public WireMockRule wireMockRule = new WireMockRule (PORT );
62
+ @ Rule public WireMockRule wireMockRule = new WireMockRule (options ().dynamicPort ());
63
63
64
64
@ Before
65
65
public void setup () throws IOException {
66
- client = new ClientBuilder ().setBasePath ("http://localhost:" + PORT ).build ();
66
+ client = new ClientBuilder ().setBasePath ("http://localhost:" + wireMockRule . port () ).build ();
67
67
68
68
namespace = "default" ;
69
69
podName = "apod" ;
Original file line number Diff line number Diff line change 19
19
import static com .github .tomakehurst .wiremock .client .WireMock .stubFor ;
20
20
import static com .github .tomakehurst .wiremock .client .WireMock .urlPathEqualTo ;
21
21
import static com .github .tomakehurst .wiremock .client .WireMock .verify ;
22
+ import static com .github .tomakehurst .wiremock .core .WireMockConfiguration .options ;
22
23
import static org .junit .Assert .assertEquals ;
23
24
24
25
import com .github .tomakehurst .wiremock .junit .WireMockRule ;
@@ -46,12 +47,11 @@ public class PodLogsTest {
46
47
47
48
private ApiClient client ;
48
49
49
- private static final int PORT = 8089 ;
50
- @ Rule public WireMockRule wireMockRule = new WireMockRule (PORT );
50
+ @ Rule public WireMockRule wireMockRule = new WireMockRule (options ().dynamicPort ());
51
51
52
52
@ Before
53
53
public void setup () throws IOException {
54
- client = new ClientBuilder ().setBasePath ("http://localhost:" + PORT ).build ();
54
+ client = new ClientBuilder ().setBasePath ("http://localhost:" + wireMockRule . port () ).build ();
55
55
56
56
namespace = "default" ;
57
57
podName = "apod" ;
Original file line number Diff line number Diff line change 19
19
import static com .github .tomakehurst .wiremock .client .WireMock .stubFor ;
20
20
import static com .github .tomakehurst .wiremock .client .WireMock .urlPathEqualTo ;
21
21
import static com .github .tomakehurst .wiremock .client .WireMock .verify ;
22
+ import static com .github .tomakehurst .wiremock .core .WireMockConfiguration .options ;
22
23
import static io .kubernetes .client .ExecTest .makeStream ;
23
24
import static org .junit .Assert .assertEquals ;
24
25
import static org .junit .Assert .assertNotNull ;
45
46
public class PortForwardTest {
46
47
private String namespace ;
47
48
private String podName ;
48
- private String container ;
49
49
50
50
private ApiClient client ;
51
51
52
- private static final int PORT = 8089 ;
53
- @ Rule public WireMockRule wireMockRule = new WireMockRule (PORT );
52
+ @ Rule public WireMockRule wireMockRule = new WireMockRule (options ().dynamicPort ());
54
53
55
54
@ Before
56
55
public void setup () throws IOException {
57
- client = new ClientBuilder ().setBasePath ("http://localhost:" + PORT ).build ();
56
+ client = new ClientBuilder ().setBasePath ("http://localhost:" + wireMockRule . port () ).build ();
58
57
59
58
namespace = "default" ;
60
59
podName = "apod" ;
61
- container = "acontainer" ;
62
60
}
63
61
64
62
@ Test
You can’t perform that action at this time.
0 commit comments