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());
}
Aggregations