use of io.kubernetes.client.openapi.ApiClient 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.openapi.ApiClient 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");
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class KubernetesApiResponseTest method setup.
@Before
public void setup() throws IOException {
ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + 8485).build();
podClient = new GenericKubernetesApi<>(V1Pod.class, V1PodList.class, "", "v1", "pods", apiClient);
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientBuilderTest method testDefaultClientUTF8EncodedConfig.
@Test
public void testDefaultClientUTF8EncodedConfig() throws Exception {
String path = withEnvironmentVariable("KUBECONFIG", KUBECONFIG_UTF8_FILE_PATH).execute(() -> {
final ApiClient client = ClientBuilder.defaultClient();
return client.getBasePath();
});
assertEquals("http://kubeconfig.dir.com", path);
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientBuilderTest method testKubeconfigDisablesVerifySsl.
@Test
public void testKubeconfigDisablesVerifySsl() throws Exception {
boolean isVerifyingSsl = withEnvironmentVariable("KUBECONFIG", KUBECONFIG_HTTP_FILE_PATH).execute(() -> {
final ApiClient client = ClientBuilder.standard().build();
return client.isVerifyingSsl();
});
assertThat(isVerifyingSsl, is(false));
}
Aggregations