File tree Expand file tree Collapse file tree 4 files changed +12
-11
lines changed
util/src/test/java/io/kubernetes/client Expand file tree Collapse file tree 4 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 13
13
package io .kubernetes .client .informer .impl ;
14
14
15
15
import static com .github .tomakehurst .wiremock .client .WireMock .*;
16
+ import static com .github .tomakehurst .wiremock .core .WireMockConfiguration .options ;
16
17
import static org .junit .Assert .*;
17
18
18
19
import com .github .tomakehurst .wiremock .junit .WireMockRule ;
@@ -43,12 +44,11 @@ public class DefaultSharedIndexInformerTest {
43
44
44
45
private ApiClient client ;
45
46
46
- private static final int PORT = 8089 ;
47
- @ Rule public WireMockRule wireMockRule = new WireMockRule (PORT );
47
+ @ Rule public WireMockRule wireMockRule = new WireMockRule (options ().dynamicPort ());
48
48
49
49
@ Before
50
50
public void setup () throws IOException {
51
- client = new ClientBuilder ().setBasePath ("http://localhost:" + PORT ).build ();
51
+ client = new ClientBuilder ().setBasePath ("http://localhost:" + wireMockRule . port () ).build ();
52
52
53
53
namespace = "default" ;
54
54
podName = "apod" ;
Original file line number Diff line number Diff line change 13
13
package io .kubernetes .client .util ;
14
14
15
15
import static com .github .tomakehurst .wiremock .client .WireMock .*;
16
+ import static com .github .tomakehurst .wiremock .core .WireMockConfiguration .options ;
16
17
17
18
import com .github .tomakehurst .wiremock .junit .WireMockRule ;
18
19
import io .kubernetes .client .custom .V1Patch ;
28
29
public class PatchUtilsTest {
29
30
30
31
private ApiClient client ;
31
- private static final int PORT = 8089 ;
32
32
33
- @ Rule public WireMockRule wireMockRule = new WireMockRule (PORT );
33
+ @ Rule public WireMockRule wireMockRule = new WireMockRule (options (). dynamicPort () );
34
34
35
35
@ Before
36
36
public void setup () throws IOException {
37
- client = new ClientBuilder ().setBasePath ("http://localhost:" + PORT ).build ();
37
+ client = new ClientBuilder ().setBasePath ("http://localhost:" + wireMockRule . port () ).build ();
38
38
}
39
39
40
40
@ Test
Original file line number Diff line number Diff line change 13
13
package io .kubernetes .client .util .credentials ;
14
14
15
15
import static com .github .tomakehurst .wiremock .client .WireMock .*;
16
+ import static com .github .tomakehurst .wiremock .core .WireMockConfiguration .options ;
16
17
17
18
import com .github .tomakehurst .wiremock .client .WireMock ;
18
19
import com .github .tomakehurst .wiremock .junit .WireMockRule ;
@@ -35,12 +36,12 @@ public class TokenFileAuthenticationTest {
35
36
private static final int PORT = 8089 ;
36
37
private TokenFileAuthentication auth ;
37
38
38
- @ Rule public WireMockRule wireMockRule = new WireMockRule (PORT );
39
+ @ Rule public WireMockRule wireMockRule = new WireMockRule (options (). dynamicPort () );
39
40
40
41
@ Before
41
42
public void setup () throws IOException {
42
43
final ApiClient client = new ApiClient ();
43
- client .setBasePath ("http://localhost:" + PORT );
44
+ client .setBasePath ("http://localhost:" + wireMockRule . port () );
44
45
this .auth = new TokenFileAuthentication (SERVICEACCOUNT_TOKEN1_PATH );
45
46
this .auth .provide (client );
46
47
Configuration .setDefaultApiClient (client );
Original file line number Diff line number Diff line change 18
18
import static com .github .tomakehurst .wiremock .client .WireMock .getRequestedFor ;
19
19
import static com .github .tomakehurst .wiremock .client .WireMock .urlPathEqualTo ;
20
20
import static com .github .tomakehurst .wiremock .client .WireMock .verify ;
21
+ import static com .github .tomakehurst .wiremock .core .WireMockConfiguration .options ;
21
22
import static org .junit .Assert .assertEquals ;
22
23
23
24
import com .github .tomakehurst .wiremock .junit .WireMockRule ;
@@ -34,12 +35,11 @@ public class VersionTest {
34
35
35
36
private ApiClient client ;
36
37
37
- private static final int PORT = 8091 ;
38
- @ Rule public WireMockRule wireMockRule = new WireMockRule (PORT );
38
+ @ Rule public WireMockRule wireMockRule = new WireMockRule (options ().dynamicPort ());
39
39
40
40
@ Before
41
41
public void setup () throws IOException {
42
- client = new ClientBuilder ().setBasePath ("http://localhost:" + PORT ).build ();
42
+ client = new ClientBuilder ().setBasePath ("http://localhost:" + wireMockRule . port () ).build ();
43
43
}
44
44
45
45
@ Test
You can’t perform that action at this time.
0 commit comments