use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientBuilderTest method testHomeDirPreferredOverKubeConfig.
@Test
public void testHomeDirPreferredOverKubeConfig() throws Exception {
String path = withEnvironmentVariable("HOME", HOME_PATH).and("KUBEDIR", KUBEDIR).and("KUBECONFIG", KUBECONFIG).execute(() -> {
final ApiClient client = ClientBuilder.standard().build();
return client.getBasePath();
});
assertEquals(path, "http://home.dir.com");
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientBuilderTest method testKubeconfigAddsSchemeHttps.
@Test
public void testKubeconfigAddsSchemeHttps() throws Exception {
String path = withEnvironmentVariable("KUBECONFIG", KUBECONFIG_HTTPS_FILE_PATH).execute(() -> {
final ApiClient client = ClientBuilder.standard().build();
return client.getBasePath();
});
assertThat(path, is("https://localhost:443"));
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientBuilderTest method testDefaultClientReadsHomeDir.
@Test
public void testDefaultClientReadsHomeDir() throws Exception {
String path = withEnvironmentVariable("HOME", HOME_PATH).execute(() -> {
ApiClient client = ClientBuilder.defaultClient();
return client.getBasePath();
});
assertEquals("http://home.dir.com", path);
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientBuilderTest method testStandardVerifiesSsl.
@Test
public void testStandardVerifiesSsl() throws Exception {
boolean isVerifyingSsl = withEnvironmentVariable("HOME", "/non-existent").execute(() -> {
final ApiClient client = ClientBuilder.standard().build();
return client.isVerifyingSsl();
});
assertThat(isVerifyingSsl, is(true));
}
use of io.kubernetes.client.openapi.ApiClient in project java by kubernetes-client.
the class ClientBuilderTest method testKubeconfigPreferredOverHomeDir.
@Test
public void testKubeconfigPreferredOverHomeDir() throws Exception {
String path = withEnvironmentVariable("HOME", HOME_PATH).and("KUBECONFIG", KUBECONFIG_FILE_PATH).execute(() -> {
final ApiClient client = ClientBuilder.standard().build();
return client.getBasePath();
});
// $KUBECONFIG should take precedence over $HOME/.kube/config
assertEquals("http://kubeconfig.dir.com", path);
}
Aggregations