Search in sources :

Example 86 with Service

use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project dekorate by dekorateio.

the class Feat642TrafficSplittingTest method shouldContainRequestsPerSecond.

@Test
public void shouldContainRequestsPerSecond() {
    KubernetesList list = Serialization.unmarshalAsList(getClass().getClassLoader().getResourceAsStream("META-INF/dekorate/knative.yml"));
    assertNotNull(list);
    Service s = findFirst(list, Service.class).orElseThrow(() -> new IllegalStateException());
    assertNotNull(s);
    assertEquals(1, s.getSpec().getTraffic().size());
    TrafficTarget traffic = s.getSpec().getTraffic().get(0);
    assertEquals("my-revision", s.getSpec().getTemplate().getMetadata().getName());
    assertEquals("my-revision", traffic.getRevisionName());
    assertEquals((long) 80, traffic.getPercent());
    assertFalse(traffic.getLatestRevision());
}
Also used : Service(io.fabric8.knative.serving.v1.Service) KubernetesList(io.fabric8.kubernetes.api.model.KubernetesList) TrafficTarget(io.fabric8.knative.serving.v1.TrafficTarget) Test(org.junit.jupiter.api.Test)

Example 87 with Service

use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project dekorate by dekorateio.

the class Feat575LocalAutoscalingTest method shouldContainRequestsPerSecond.

@Test
public void shouldContainRequestsPerSecond() {
    KubernetesList list = Serialization.unmarshalAsList(getClass().getClassLoader().getResourceAsStream("META-INF/dekorate/knative.yml"));
    assertNotNull(list);
    Service s = findFirst(list, Service.class).orElseThrow(() -> new IllegalStateException());
    String metric = s.getMetadata().getAnnotations().get("autoscaling.knative.dev/metric");
    assertEquals("rps", metric);
    String target = s.getMetadata().getAnnotations().get("autoscaling.knative.dev/target");
    assertEquals("100", target);
}
Also used : Service(io.fabric8.knative.serving.v1.Service) KubernetesList(io.fabric8.kubernetes.api.model.KubernetesList) Test(org.junit.jupiter.api.Test)

Example 88 with Service

use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project dekorate by dekorateio.

the class Issue687KnativeVolumeTest method shouldHaveVolumesAndMounts.

@Test
public void shouldHaveVolumesAndMounts() {
    KubernetesList list = Serialization.unmarshalAsList(getClass().getClassLoader().getResourceAsStream("META-INF/dekorate/knative.yml"));
    assertNotNull(list);
    Service s = findFirst(list, Service.class).orElseThrow(() -> new IllegalStateException());
    assertNotNull(s);
    assertTrue(s.getSpec().getTemplate().getSpec().getVolumes().size() > 0);
    Container c = s.getSpec().getTemplate().getSpec().getContainers().get(0);
    assertNotNull(c);
    assertTrue(c.getVolumeMounts().size() > 0);
}
Also used : Container(io.fabric8.kubernetes.api.model.Container) Service(io.fabric8.knative.serving.v1.Service) KubernetesList(io.fabric8.kubernetes.api.model.KubernetesList) Test(org.junit.jupiter.api.Test)

Example 89 with Service

use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project dekorate by dekorateio.

the class Issue586ScaleBoundsTest method shouldContainMinAndMaxBounds.

@Test
public void shouldContainMinAndMaxBounds() {
    KubernetesList list = Serialization.unmarshalAsList(getClass().getClassLoader().getResourceAsStream("META-INF/dekorate/knative.yml"));
    assertNotNull(list);
    Service s = findFirst(list, Service.class).orElseThrow(() -> new IllegalStateException());
    String minScale = s.getMetadata().getAnnotations().get("autoscaling.knative.dev/minScale");
    String maxScale = s.getMetadata().getAnnotations().get("autoscaling.knative.dev/maxScale");
    assertEquals("3", minScale);
    assertEquals("5", maxScale);
}
Also used : Service(io.fabric8.knative.serving.v1.Service) KubernetesList(io.fabric8.kubernetes.api.model.KubernetesList) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)34 Service (io.fabric8.knative.serving.v1.Service)28 Connector (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector)22 Service (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service)22 CoreException (org.eclipse.core.runtime.CoreException)18 MockGrpcService (com.google.api.gax.grpc.testing.MockGrpcService)16 Service (com.google.monitoring.v3.Service)16 IOException (java.io.IOException)16 Test (org.junit.Test)16 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)14 AbstractMessage (com.google.protobuf.AbstractMessage)11 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)11 ProdBuildResults (io.quarkus.test.ProdBuildResults)11 ProdModeTestResults (io.quarkus.test.ProdModeTestResults)11 QuarkusProdModeTest (io.quarkus.test.QuarkusProdModeTest)11 Path (java.nio.file.Path)11 ArrayList (java.util.ArrayList)11 RegisterExtension (org.junit.jupiter.api.extension.RegisterExtension)11 List (java.util.List)10 DisplayName (org.junit.jupiter.api.DisplayName)10