use of io.kubernetes.client.util.ClientBuilder in project java by kubernetes-client.
the class PortForwardTest method setup.
@Before
public void setup() throws IOException {
client = new ClientBuilder().setBasePath("http://localhost:" + wireMockRule.port()).build();
namespace = "default";
podName = "apod";
}
use of io.kubernetes.client.util.ClientBuilder in project java by kubernetes-client.
the class GenericKubernetesApiForCoreApiTest method setup.
@Before
public void setup() throws IOException {
ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + 8181).build();
podClient = new GenericKubernetesApi<>(V1Pod.class, V1PodList.class, "", "v1", "pods", apiClient);
}
use of io.kubernetes.client.util.ClientBuilder in project java by kubernetes-client.
the class GenericKubernetesApiForCoreApiTest method testReadTimeoutShouldThrowException.
@Test
public void testReadTimeoutShouldThrowException() {
ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + 8181).build();
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().readTimeout(1, // timeout everytime
TimeUnit.MILLISECONDS).build());
stubFor(get(urlEqualTo("/api/v1/namespaces/foo/pods/test")).willReturn(aResponse().withFixedDelay(99999).withStatus(200).withBody("")));
podClient = new GenericKubernetesApi<>(V1Pod.class, V1PodList.class, "", "v1", "pods", apiClient);
try {
KubernetesApiResponse<V1Pod> response = podClient.get("foo", "test");
} catch (Throwable t) {
assertTrue(t.getCause() instanceof SocketTimeoutException);
return;
}
fail("no exception happened");
}
use of io.kubernetes.client.util.ClientBuilder in project java by kubernetes-client.
the class GenericKubernetesGetApiTest method setup.
@Before
public void setup() {
ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + 8181).build();
jobClient = new GenericKubernetesApi<>(V1Job.class, V1JobList.class, "batch", "v1", "jobs", apiClient);
fooClient = new GenericKubernetesApi<>(FooCustomResource.class, FooCustomResourceList.class, "example.io", "v1", "foos", apiClient);
}
use of io.kubernetes.client.util.ClientBuilder in project java by kubernetes-client.
the class GenericKubernetesApiTest method testReadTimeoutShouldThrowException.
@Test
public void testReadTimeoutShouldThrowException() {
ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + 8181).build();
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().readTimeout(1, // timeout everytime
TimeUnit.MILLISECONDS).build());
stubFor(get(urlEqualTo("/apis/batch/v1/namespaces/foo/jobs/test")).willReturn(aResponse().withFixedDelay(99999).withStatus(200).withBody("")));
jobClient = new GenericKubernetesApi<>(V1Job.class, V1JobList.class, "batch", "v1", "jobs", apiClient);
try {
KubernetesApiResponse<V1Job> response = jobClient.get("foo", "test");
} catch (Throwable t) {
assertTrue(t.getCause() instanceof SocketTimeoutException);
return;
}
fail("no exception happened");
}
Aggregations