use of org.eclipse.jkube.kit.common.SystemMock in project jkube by eclipse.
the class AuthConfigFactoryTest method testGetAuthConfigFromOpenShiftConfig.
@Test
public void testGetAuthConfigFromOpenShiftConfig() {
// Given
new SystemMock().put("jkube.docker.useOpenShiftAuth", "true");
Map<String, Object> authConfigMap = new HashMap<>();
new MockUp<KubernetesConfigAuthUtil>() {
@Mock
AuthConfig readKubeConfigAuth() {
return AuthConfig.builder().username("test").password("sometoken").build();
}
};
// When
AuthConfig authConfig = AuthConfigFactory.getAuthConfigFromOpenShiftConfig(AuthConfigFactory.LookupMode.DEFAULT, authConfigMap);
// Then
assertAuthConfig(authConfig, "test", "sometoken");
}
use of org.eclipse.jkube.kit.common.SystemMock in project jkube by eclipse.
the class AuthConfigFactoryTest method testGetStandardAuthConfigFromProperties.
@Test
public void testGetStandardAuthConfigFromProperties(@Mocked KitLogger logger) throws IOException {
// Given
new SystemMock().put("jkube.docker.username", "testuser").put("jkube.docker.password", "testpass");
// When
AuthConfigFactory authConfigFactory = new AuthConfigFactory(logger);
AuthConfig authConfig = authConfigFactory.createAuthConfig(true, true, Collections.emptyMap(), Collections.emptyList(), "testuser", "testregistry.io", s -> s);
// Then
assertAuthConfig(authConfig, "testuser", "testpass");
}
use of org.eclipse.jkube.kit.common.SystemMock in project jkube by eclipse.
the class AuthConfigFactoryTest method testGetAuthConfigFromSystemProperties.
@Test
public void testGetAuthConfigFromSystemProperties() throws IOException {
// Given
new SystemMock().put("jkube.docker.username", "testuser").put("jkube.docker.password", "testpass");
// When
AuthConfig authConfig = AuthConfigFactory.getAuthConfigFromSystemProperties(AuthConfigFactory.LookupMode.DEFAULT, s -> s);
// Then
assertAuthConfig(authConfig, "testuser", "testpass");
}
use of org.eclipse.jkube.kit.common.SystemMock in project jkube by eclipse.
the class ThorntailV2HealthCheckEnricherTest method createWithThorntailSpecificPropertiesInKubernetes.
@Test
public void createWithThorntailSpecificPropertiesInKubernetes() {
// Given
new SystemMock().put("thorntail.http.port", "1337");
final ThorntailV2HealthCheckEnricher thorntailV2HealthCheckEnricher = new ThorntailV2HealthCheckEnricher(context);
// When
new ThorntailV2HealthCheckEnricher(context).create(PlatformMode.kubernetes, klb);
// Then
assertThat(klb.build().getItems()).hasSize(1).extracting("spec", DeploymentSpec.class).extracting("template", PodTemplateSpec.class).extracting("spec", PodSpec.class).flatExtracting(PodSpec::getContainers).extracting("livenessProbe.initialDelaySeconds", "livenessProbe.httpGet.scheme", "livenessProbe.httpGet.path", "readinessProbe.initialDelaySeconds", "readinessProbe.httpGet.scheme", "readinessProbe.httpGet.path", "readinessProbe.httpGet.port.intVal").containsExactly(tuple(180, "HTTP", "/health", 10, "HTTP", "/health", 1337));
}
use of org.eclipse.jkube.kit.common.SystemMock in project jkube by eclipse.
the class EnvUtilTest method testIsWindows.
@Test
public void testIsWindows() {
// Given
new SystemMock().put("os.name", "windows");
// When
boolean result = EnvUtil.isWindows();
// Then
assertThat(result).isTrue();
}
Aggregations