use of io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder in project ingress-access-operator by neo9.
the class VisitorGroupServiceExposerReconcilerTest method shouldWellComputeWhitelistForTwoGroupWithCommaTypo.
@Test
public void shouldWellComputeWhitelistForTwoGroupWithCommaTypo() {
// given
Ingress ingress = new IngressBuilder().withNewMetadata().withName("test").withAnnotations(Map.of(MutationAnnotations.MUTABLE_INGRESS_VISITOR_GROUP_KEY, "vg1,,vg2,")).endMetadata().build();
// when
String cidrListAsString = visitorGroupIngressReconciler.getCidrListAsString(ingress);
// then
assertThat(cidrListAsString).isEqualTo(visitorGroup1Ips + "," + visitorGroup2Ips);
}
use of io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder in project ingress-access-operator by neo9.
the class VisitorGroupServiceExposerReconcilerTest method shouldWellComputeWhitelistForOneGroup.
@Test
public void shouldWellComputeWhitelistForOneGroup() {
// given
Ingress ingress = new IngressBuilder().withNewMetadata().withName("test").withAnnotations(Map.of(MutationAnnotations.MUTABLE_INGRESS_VISITOR_GROUP_KEY, "vg1")).endMetadata().build();
// when
String cidrListAsString = visitorGroupIngressReconciler.getCidrListAsString(ingress);
// then
assertThat(cidrListAsString).isEqualTo(visitorGroup1Ips);
}
use of io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder in project ingress-access-operator by neo9.
the class VisitorGroupServiceExposerReconcilerTest method shouldWellComputeWhitelistForTwoGroupWithCommonRange.
@Test
public void shouldWellComputeWhitelistForTwoGroupWithCommonRange() {
// given
Ingress ingress = new IngressBuilder().withNewMetadata().withName("test").withAnnotations(Map.of(MutationAnnotations.MUTABLE_INGRESS_VISITOR_GROUP_KEY, "vg1,vg1bis")).endMetadata().build();
// when
String cidrListAsString = visitorGroupIngressReconciler.getCidrListAsString(ingress);
// then
assertThat(cidrListAsString).isEqualTo(visitorGroup1Ips + "," + visitorGroup1bisIp2);
}
use of io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder in project kubernetes-client by fabric8io.
the class NetworkingV1IngressTest method testDeleteMulti.
@Test
void testDeleteMulti() {
Ingress ingress1 = new IngressBuilder().withNewMetadata().withName("ingress1").withNamespace("test").and().build();
Ingress ingress2 = new IngressBuilder().withNewMetadata().withName("ingress2").withNamespace("ns1").and().build();
Ingress ingress3 = new IngressBuilder().withNewMetadata().withName("ingress3").withNamespace("any").and().build();
server.expect().withPath("/apis/networking.k8s.io/v1/namespaces/test/ingresses/ingress1").andReturn(HttpURLConnection.HTTP_OK, ingress1).once();
server.expect().withPath("/apis/networking.k8s.io/v1/namespaces/ns1/ingresses/ingress2").andReturn(HttpURLConnection.HTTP_OK, ingress2).once();
Boolean deleted = client.network().v1().ingresses().inAnyNamespace().delete(ingress1, ingress2);
assertTrue(deleted);
deleted = client.network().v1().ingresses().inAnyNamespace().delete(ingress3);
assertFalse(deleted);
}
use of io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder in project kubernetes-client by fabric8io.
the class NetworkingV1IngressTest method testGet.
@Test
void testGet() {
server.expect().withPath("/apis/networking.k8s.io/v1/namespaces/test/ingresses/ingress1").andReturn(HttpURLConnection.HTTP_OK, new IngressBuilder().build()).once();
server.expect().withPath("/apis/networking.k8s.io/v1/namespaces/ns1/ingresses/ingress2").andReturn(HttpURLConnection.HTTP_OK, new IngressBuilder().build()).once();
Ingress ingress = client.network().v1().ingresses().withName("ingress1").get();
assertNotNull(ingress);
ingress = client.network().v1().ingresses().withName("ingress2").get();
assertNull(ingress);
ingress = client.network().v1().ingresses().inNamespace("ns1").withName("ingress2").get();
assertNotNull(ingress);
}
Aggregations