Search in sources :

Example 6 with HTTPS_PROXY

use of org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner.HTTPS_PROXY in project devspaces-images by redhat-developer.

the class ProxySettingsProvisionerTest method shouldNotApplyProxySettingsToJWTProxyContainer.

@Test
public void shouldNotApplyProxySettingsToJWTProxyContainer() throws Exception {
    Map<String, Pod> pods = new HashMap<>();
    pods.put(JWT_PROXY_POD_NAME, buildPod(JWT_PROXY_POD_NAME, buildContainers(2)));
    KubernetesEnvironment k8sEnv = KubernetesEnvironment.builder().setPods(pods).build();
    provisioner.provision(k8sEnv, runtimeId);
    assertTrue(k8sEnv.getPodsData().values().stream().filter(pod -> pod.getMetadata().getName().equals(JWT_PROXY_POD_NAME)).flatMap(pod -> pod.getSpec().getContainers().stream()).noneMatch(container -> container.getEnv().contains(new EnvVar(HTTP_PROXY, HTTP_PROXY_VALUE, null)) || container.getEnv().contains(new EnvVar(HTTPS_PROXY, HTTPS_PROXY_VALUE, null)) || container.getEnv().contains(new EnvVar(NO_PROXY, NO_PROXY_VALUE, null))));
}
Also used : HTTP_PROXY(org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner.HTTP_PROXY) EnvVar(io.fabric8.kubernetes.api.model.EnvVar) Arrays(java.util.Arrays) NameGenerator.generate(org.eclipse.che.commons.lang.NameGenerator.generate) Listeners(org.testng.annotations.Listeners) Container(io.fabric8.kubernetes.api.model.Container) Mock(org.mockito.Mock) KubernetesEnvironment(org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment) HashMap(java.util.HashMap) Test(org.testng.annotations.Test) Mockito.lenient(org.mockito.Mockito.lenient) ArrayList(java.util.ArrayList) HTTPS_PROXY(org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner.HTTPS_PROXY) NO_PROXY(org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner.NO_PROXY) JWT_PROXY_POD_NAME(org.eclipse.che.workspace.infrastructure.kubernetes.server.secure.jwtproxy.JwtProxyProvisioner.JWT_PROXY_POD_NAME) PodBuilder(io.fabric8.kubernetes.api.model.PodBuilder) Map(java.util.Map) ContainerBuilder(io.fabric8.kubernetes.api.model.ContainerBuilder) MockitoTestNGListener(org.mockito.testng.MockitoTestNGListener) BeforeMethod(org.testng.annotations.BeforeMethod) Pod(io.fabric8.kubernetes.api.model.Pod) List(java.util.List) Stream(java.util.stream.Stream) RuntimeIdentity(org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity) Assert.assertTrue(org.testng.Assert.assertTrue) Pod(io.fabric8.kubernetes.api.model.Pod) HashMap(java.util.HashMap) KubernetesEnvironment(org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment) EnvVar(io.fabric8.kubernetes.api.model.EnvVar) Test(org.testng.annotations.Test)

Aggregations

Container (io.fabric8.kubernetes.api.model.Container)6 ContainerBuilder (io.fabric8.kubernetes.api.model.ContainerBuilder)6 EnvVar (io.fabric8.kubernetes.api.model.EnvVar)6 Pod (io.fabric8.kubernetes.api.model.Pod)6 PodBuilder (io.fabric8.kubernetes.api.model.PodBuilder)6 ArrayList (java.util.ArrayList)6 Arrays (java.util.Arrays)6 HashMap (java.util.HashMap)6 List (java.util.List)6 Map (java.util.Map)6 Stream (java.util.stream.Stream)6 RuntimeIdentity (org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity)6 NameGenerator.generate (org.eclipse.che.commons.lang.NameGenerator.generate)6 KubernetesEnvironment (org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment)6 HTTPS_PROXY (org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner.HTTPS_PROXY)6 HTTP_PROXY (org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner.HTTP_PROXY)6 NO_PROXY (org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner.NO_PROXY)6 JWT_PROXY_POD_NAME (org.eclipse.che.workspace.infrastructure.kubernetes.server.secure.jwtproxy.JwtProxyProvisioner.JWT_PROXY_POD_NAME)6 Mock (org.mockito.Mock)6 Mockito.lenient (org.mockito.Mockito.lenient)6