Search in sources :

Example 1 with V1beta1IngressBackend

use of io.kubernetes.client.models.V1beta1IngressBackend in project weblogic-kubernetes-operator by oracle.

the class IngressHelperTest method testAddThenRemoveServer.

@Test
public void testAddThenRemoveServer() throws Throwable {
    Packet p = new Packet();
    p.getComponents().put(ProcessingConstants.DOMAIN_COMPONENT_NAME, Component.createFor(info));
    p.put(ProcessingConstants.SERVER_SCAN, info.getScan().getServerConfig(server1Name));
    p.put(ProcessingConstants.CLUSTER_SCAN, info.getScan().getClusterConfig(clusterName));
    p.put(ProcessingConstants.SERVER_NAME, server1Name);
    Fiber f = engine.createFiber();
    Step s = IngressHelper.createClusterStep(null);
    AtomicReference<Throwable> t = new AtomicReference<>();
    f.start(s, p, new CompletionCallback() {

        @Override
        public void onCompletion(Packet packet) {
        // no-op
        }

        @Override
        public void onThrowable(Packet packet, Throwable throwable) {
            t.set(throwable);
        }
    });
    f.get(30, TimeUnit.SECONDS);
    if (t.get() != null) {
        throw t.get();
    }
    // Now check
    CallBuilderFactory factory = new CallBuilderFactory(null);
    V1beta1Ingress v1beta1Ingress = factory.create().readIngress(ingressName, namespace);
    List<V1beta1HTTPIngressPath> v1beta1HTTPIngressPaths = getPathArray(v1beta1Ingress);
    Assert.assertEquals("IngressPaths should have one instance of IngressPath", 1, v1beta1HTTPIngressPaths.size());
    V1beta1HTTPIngressPath v1beta1HTTPIngressPath = v1beta1HTTPIngressPaths.get(0);
    Assert.assertEquals("/", v1beta1HTTPIngressPath.getPath());
    V1beta1IngressBackend v1beta1IngressBackend = v1beta1HTTPIngressPath.getBackend();
    Assert.assertNotNull("IngressBackend Object should not be null", v1beta1IngressBackend);
    Assert.assertEquals("Service name should be " + clusterServiceName, clusterServiceName, v1beta1IngressBackend.getServiceName());
    Assert.assertEquals("Service port should be " + server1Port, server1Port, v1beta1IngressBackend.getServicePort().getIntValue());
}
Also used : Packet(oracle.kubernetes.operator.work.Packet) Fiber(oracle.kubernetes.operator.work.Fiber) V1beta1IngressBackend(io.kubernetes.client.models.V1beta1IngressBackend) AtomicReference(java.util.concurrent.atomic.AtomicReference) Step(oracle.kubernetes.operator.work.Step) V1beta1HTTPIngressPath(io.kubernetes.client.models.V1beta1HTTPIngressPath) V1beta1Ingress(io.kubernetes.client.models.V1beta1Ingress) CompletionCallback(oracle.kubernetes.operator.work.Fiber.CompletionCallback) Test(org.junit.Test)

Aggregations

V1beta1HTTPIngressPath (io.kubernetes.client.models.V1beta1HTTPIngressPath)1 V1beta1Ingress (io.kubernetes.client.models.V1beta1Ingress)1 V1beta1IngressBackend (io.kubernetes.client.models.V1beta1IngressBackend)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Fiber (oracle.kubernetes.operator.work.Fiber)1 CompletionCallback (oracle.kubernetes.operator.work.Fiber.CompletionCallback)1 Packet (oracle.kubernetes.operator.work.Packet)1 Step (oracle.kubernetes.operator.work.Step)1 Test (org.junit.Test)1